nerdexam
Oracle

1Z0-851 · Question #154

Given: 10. class Nav{ 11. public enum Direction { NORTH, SOUTH, EAST, WEST } 12. } 13. public class Sprite{ 14. // insert code here 15. } Which code, inserted at line 14, allows the Sprite class to…

The correct answer is D. Nav.Direction d = Nav.Direction.NORTH. See the full explanation below for the reasoning.

Question

Given: 10. class Nav{ 11. public enum Direction { NORTH, SOUTH, EAST, WEST } 12. } 13. public class Sprite{ 14. // insert code here 15. } Which code, inserted at line 14, allows the Sprite class to compile?

Options

  • ADirection d = NORTH;
  • BNav.Direction d = NORTH;
  • CDirection d = Direction.NORTH;
  • DNav.Direction d = Nav.Direction.NORTH;

How the community answered

(40 responses)
  • A
    15% (6)
  • B
    5% (2)
  • C
    8% (3)
  • D
    73% (29)

Community Discussion

No community discussion yet for this question.

Full 1Z0-851 Practice