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 method in java ?
How can we pass argument to a function by reference instead of pass by value?
What are the characteristics of Final,Finally and Finalize keywords.
What is a singleton class in Java?
What is the difference between throw and throws keywords?
Explain features of interfaces in java?
Define immutable object?
Highest level event class of the event-delegation model?
5 Coding best practices you learned in java?
Why is core java important?
Explain spliterator in java8?
What is prefix of a string?
What is the use of inner class?
Why does it take so much time to access an applet having swing components the first time?
Why is a constant variable important?