Question: Write a Java program named NameParser which can ask user for his/her full name, and then parse the name to get first name and last
Write a Java program named "NameParser" which can ask user for his/her full name, and then parse the name to get first name and last name.
Simulate the following interaction:
Hint:
sc.nextLine() can read in a whole line.
Assume that the user enters full name in "FirstName LastName" format, e.g., if the user enter Alex Johnson, that means Alex is the first name, Johnson is the last name, and the whitespace is the delimiter.
Make use of indexOf() method and .substring() method to extract first name and last name from the full name user entered.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
