SCJP Module-1 Question-14

This program checks your knowledge of Java program and also prepare you for SCJP examination.

 
 

Share on Google+Share on Google+

SCJP Module-1 Question-14

Ads

This program checks your knowledge of Java program and also prepare you for SCJP examination.

Given a sample code:

1 class ListState {
2 public enum State{DELHI, MUMBAI, MADRAS}
}

3 public class Sample4 {
4 public static void main(String args[]) {
5  // Place the statement here
}}

What statement you place at line number 5 for successful compilation and execution of above code?

(1)    ListState state = ListState.DELHI;

(2)    ListState.State state = ListState.State.MADRAS;

(3)    ListState state = MUMBAI;

(4)    ListState state = ListState.MUMBAI;

Answer

(2)

Advertisements

Posted on: July 8, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles