22.8k views
1 vote
Consider the following code snippet. Assuming that the user inputs 75 as the age, what is the output? int age = 0; Scanner in = new Scanner(System.in); System.out.print("Please enter your age: "); age = in.nextInt(); if (age < 10) { System.out.print("Child "); } if (age < 30) { System.out.print("Young adult "); } if (age < 70) { System.out.print("Old "); } if (age < 100) { System.out.print("Impressively old "); }

User Rbutcher
by
7.5k points

1 Answer

4 votes

Answer:

Impressively old

Step-by-step explanation:

The following code uses multiple if statements to check a user's age. It displays a corresponding information according to the range of age that is entered. In the question scenario given, when a user enters an age of 75, this is only fufilled in the last conditional block if (age<100) So the code block following System.out.print("Impressively old ") will be executed.

User Ludisposed
by
6.6k points