Single Choice Not Set

QWhat will be the output for the below code?
static public class Test{
      public static void main(String[] args){
            char c = 'a';

            switch(c){
                  case 65 : System.out.println("one");break;
		  case 'a': System.out.println("two");break;
		  case 3  : System.out.println("three");
            }	
      }
}

ID: #2120 Declaration and Access Control in Java 697 views
Question Info
#2120Q ID
Not SetDifficulty
Declaration and Access Control in JavaTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A one
  • B two
  • C Compile error - char can't be permitted in switch statement.
  • D Compile error - Illegal modifier for the class Test; only public, abstract & final are permitted.
Correct Answer

Explanation

Compile error - Illegal modifier for the class Test; only public, abstract & final are permitted.

Share This Question

Challenge a friend or share with your study group.

Related MCQ Questions