Question: What is the value stored in the n variable after executing the following Java program fragment? int n = 1 0 ; char code =

What is the value stored in the n variable after executing the following Java program fragment?
int n =10;
char code =' b';
switch (code){
case 'a':
case 'A':
n +=1;
break;
case 'b':
case 'B':
n -=2;
break;
case 'c':
case 'C':
n +=2;
break;
default:
n =13;
}
Select one:
11
compilation error
runtime error
12
8
13
none of the above
What is the value stored in the n variable after

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 Programming Questions!