Which code, inserted at line 14, allows the Sprite class to compile?

Given:

09. class Nav{
10. public enum Direction { NORTH, SOUTH, EAST, WEST }
11. }
12.
13. public class Sprite{
14. // insert code here
15. }

Which code, inserted at line 14, allows the Sprite class to compile?

Given:

09. class Nav{
10. public enum Direction { NORTH, SOUTH, EAST, WEST }
11. }
12.
13. public class Sprite{
14. // insert code here
15. }

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;

Explanation:
Enum is accessible via <class name>.<enum name>.
Its values are accessible via <class name>.<enum name>.<enum value>.



Leave a Reply 0

Your email address will not be published. Required fields are marked *