Question: If the user entered the value 5 , what is the output from the following code snippet? Scanner input = new Scanner ( System.in )

If the user entered the value 5, what is the output from the following code snippet?
Scanner input = new Scanner(
System.in);
int option = input.nextlnt();
switch(option){
case 5 :
option = option +1
case 2 :
option = option +4
case 3:
option = option +3
default:
option = option +2
}
System.out.println(option);
Select one:
4
15
8
5
 If the user entered the value 5, what is the output

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!