You are not logged in.

#1 2015-06-15 08:43:13

husnain
User RankUser RankUser RankUser RankUser RankUser Rank
Administrator
From: Chichawatni,Pakistan
Registered: 2014-10-03
Posts: 8,129
Website

Java Compile Error:

Java Quizzes Java Language Access Control And Declaration

Directions:
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");
            }   
      }
}

Question:
What will be the output for the below code?

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

Correct Answer is Option D):
Compile error - Illegal modifier for the class Test; only public, abstract & final are permitted


You cannot discover the new oceans unless you have the courage to lose the sight of the shore.

2015-06-15 08:43:13

Advertisement
Ads By Google

Re: Java Compile Error:



\n

Board footer