Question: The following code does not show errors in NetBeans. It even compiles properly. However, the code crashes after entries have been made. a. What is

The following code does not show errors in NetBeans. It even compiles properly. However, the code crashes after entries have been made.

a. What is the issue?

b. How would you fix it?

c. After it is fixed (supply the fixed code), what would the formatted output be?

Note***The variables are declared correctly

//Begin Main Method

public static void main(String[] args) {

int age = 0;

String fName; Scanner sc = new Scanner(System.in);

System.out.print("Please enter your first name: ");

fName = sc.next();

System.out.print("Please enter your age: ");

age = sc.nextInt();

System.out.printf("Hello %d You don't look like you're %f years old! ", fName, age);

} //End Main Method Previous Next

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!