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 do you mean by platform independence of Java?
How to instantiate member inner class?
Explain the difference between throw and throws in java?
What is an empirical question?
What is java life cycle?
Why do we need data structure in java?
Are there structures in java?
What are disadvantages of java?
What is user defined exception in Java?
What do you mean by access modifier?
What is the static variable?
What is the difference between state-based unit testing and interaction-based unit testing?
How do you identify if jvm is 32-bit or 64-bit from java program?
What is a locale?
Is void a wrapper class?