Wednesday, 1 November 2017

#13. SCJP/OCJP Exams Questions & Answers-Which code, inserted at line 14, allows the Sprite class to compile?


13. Given:
class Nav{
 public enum Direction { NORTH, SOUTH, EAST, WEST }
 }
 public class Sprite{
 // insert code here
 }
Which code, inserted at line 14, allows the Sprite class to compile?
A. Direction d = NORTH;
B. Nav.Direction d = NORTH;
C. Direction d = Direction.NORTH;
D. Nav.Direction d = Nav.Direction.NORTH;


Correct Answer: D

No comments:

Post a Comment

#45 to #51 SCJP/OCJP Exams Questions & Answers-

45. Given: 1. public class A { 2. public void doit() { 3. } 4. public String doit() { 5. return "a"; 6. } 7. ...