Question
Write a Java code to create a String variable called firstName, define it to be your first name as a String. Then define a variable
Write a Java code to create a String variable called firstName, define it to be your first name as a String. Then define a variable called lastName and define it to be your last name as a String. Then define a variable called fullName and set it to be your first name followed by a space followed by your last name. Use the existing variables for your first and last name and String concatenation to define fullName. Finally, write code to print this text:
Hello, my name is [full name].
There are [number] letters in my name.
Use String concatenation to create the first String to print using the fullName variable, and use the .length() command on firstName and lastName to calculate the number of letters.
Note: you can concatenate an integer and a String and the integer will be converted to a String.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started