Oracle 1Z0-808 Exam question no. 36

Q. - Given the code fragment:- 

5. int color;

6. char colorCode = 'b'; 
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 prints: 10


⧪ please give your answer in a comment section.

Post a Comment

2 Comments