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 the diffrence between inner class and nested class?
Why do we override tostring method in java?
What is bufferedwriter?
What is math floor in java?
What is a double vs float?
What is the longest unicode character?
What are default methods ?
What are different types of references?
What are the 3 types of loops in java?
What is functional interface in javatpoint?
What is the difference between final, finally and finalize() in java?
Can a lock be acquired on a class in java programming?
What are the restriction imposed on a static method or a static block of code?
Can bool be null?
Is 0 true or false?