002-001-014

Basic String Type Operations

Easy

Problem Description

Basic String Type Operations

In this problem, you will create a program that reads two strings from standard input, concatenates them using the + operator, and displays the full name and string length to standard output.

Learning Objective: Understand basic String type declaration, assignment, and concatenation

Overview

Java's String type is a class for handling text. String literals are created with double quotes, and concatenation uses the + operator.

Input Format

firstName
lastName

Specifications

  • Read the first line as firstName and the second line as lastName using Scanner
  • Concatenate and display the full name
  • Display the length of the full name string

Output Format

First: <firstName>
Last: <lastName>
Full name: <firstName> <lastName>
Length: <character count of full name>

Sample Input/Output

Input:
Taro
Yamada

Output:
First: Taro
Last: Yamada
Full name: Taro Yamada
Length: 11

Ready to Try Running Code?

Log in to access the code editor and execute your solutions for this problem.

Don't have an account?

Sign Up