Oracle 1Z0-808 Exam question no. 34

Q. - Given the code fragment:- 

6. char colorCode = 'y'; 
7. switch (colorCode) { 
8.        case 'r':
9.            int 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.

Post a Comment

5 Comments