Q. - Given the code fragment:-
5. int color;
6. char colorCode = 'y';
7. switch (colorCode) {
8. case 'r':
9. color = 100;
10. break;
11. case 'b':
12. color = 10;
13. break;
14. case 'y':
15. color= 1;
16. break;
17. }
18. System.out.println(color);
What is the result?
A) It results in a compile time error at line 18.
B) It results in a compile time error at line 9.
C) It prints: 1
D) It results in a compile time error at lines 12 and 15.
⧪ please give your answer in a comment section.
5. int color;
6. char colorCode = 'y';
7. switch (colorCode) {
8. case 'r':
9. color = 100;
10. break;
11. case 'b':
12. color = 10;
13. break;
14. case 'y':
15. color= 1;
16. break;
17. }
18. System.out.println(color);
What is the result?
A) It results in a compile time error at line 18.
B) It results in a compile time error at line 9.
C) It prints: 1
D) It results in a compile time error at lines 12 and 15.
⧪ please give your answer in a comment section.
2 Comments
C
ReplyDeleteC
ReplyDelete