CERTIFICATION WATCH

Get the latest certification news by email!

*





*




Our Other Sites

GoExam: Certification practice tests with free demos to download.

GoTraining: Get Training on what you need.

CertificationBooks: Find the certification book you're looking for.

Free Tech Pubs: Free computer industry magazines, newsletters, and whitepapers.

SearchCertify: links, links and more certification links!


HOT SPOTS

Sun Certified Programmer for the Java 2 Platform Quiz #2 (SCJP 1.4)

Question 11:

What will be the result of executing the following code?

public static void main(String args[])
{
        char digit = 'a';
        for (int i = 0; i < 10; i++)
        {
              switch (digit)
              {
                    case 'x' :
                    {
                        int j = 0;
                System.out.println(j);        
                    }
                    default :
                    {
                        int j = 100;
                System.out.println(j);        
                    }
              }
       }
       
    int i = j;
       System.out.println(i);    
}
A. 100 will be printed 11 times.
B. 100 will be printed 10 times and then there will be a runtime exception.
C. The code will not compile because the variable i cannot be declared twice within the main() method.
D. The code will not compile because the variable j cannot be declared twice within the switch statement.
E. None of these.

 
Follow GoCertify on Twitter