Home Tutorial Java Scjp Part5 SCJP Module-5 Question-15


Share on Google+Share on Google+
SCJP Module-5 Question-15
Posted on: July 22, 2010 at 12:00 AM
The Sample code given below will test your understanding about the switch case in Java.

Given a sample code:

1    public class Test {
2    public static void main(String[] args) {

3    int i = 100;
4    switch(i)
5    {
6    default:
7    System.out.println("Default");
8    case 100:
9    System.out.println("100");
10  case 200:
11  System.out.println("200"); }

What will be result when compiled and run?

(A)  100 200
(B)  Compilation error at line no-6.   
(C)  Compilation error at line no-9.   
(D)  Compilation error at line no-11.   




Related Tags for SCJP Module-5 Question-15:

Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: July 22, 2010

Recommend the tutorial

Advertisements Advertisements