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?
a)Direction d = NORTH;
b)Nav.Direction d = NORTH;
c)Direction d = Direction.NORTH;
d)Nav.Direction d = Nav.Direction.NORTH;
Answer Posted / manikandan [ gtec,vellore ]
Answer is d)Nav.Direction d = Nav.Direction.NORTH;
explanation:
enum is specified inside a class Nav and that can b called
from other class that so v use the reference of the class
Nav.it's jus shows Encapsulation concept
Is This Answer Correct ? | 8 Yes | 3 No |
Post New Answer View All Answers
What is a method declaration?
Can we store variables in local blocks?
How listener identify that the event came from a particular object?
What are the differences between stringbuffer and stringbuilder?
What is the nested interface?
What is the use of accept () method in java?
What is the difference between Grid and Gridbaglayout?
What is the technique adopted to create an immutable class?
Explain what is encapsulation?
What is an arraylist in java?
What is arrays aslist in java?
Does set allows null in java?
What is the program compilation process?
Is final static java?
Why deletion in linkedlist is fast than arraylist?