Question: Chapter 4 Reading Guide / 14. 94.4 - Scanner Class - Quirky Behavior saved Consider the following code segment: System.out.println(Enter your age:); int age =

Chapter 4 Reading Guide / 14. 94.4 - Scanner Class - Quirky Behavior saved Consider the following code segment: System.out.println("Enter your age:"); int age = scanner.nextInt (); System.out.println("Enter your name:"); String name = scanner.nextLine(); There is a logic error with this code. The program will accurately store the value of the user's age into age, but the program does not function appropriately when tasked with getting input from the user and storing it in name. Explain why this program will not work properly and how to fix it
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
