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;
Answers were Sorted based on User's Feedback
Answer / 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 |
What is the difference between preparedstatement and statement in java?
Can you explain inner class.
Keywords in Exceptions?
Why enumeration is faster than iterator?
difference throws and throw in java
What is the use of protected in java?
What is the difference between length and size in java?
Which is better stringbuilder or stringbuffer?
How are Java source code files named?
AWT event listeners extends what interface?
In method overloading ,if i change the return type to Long instead of INT,is the program execute
Is array primitive data type in java?