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 are static variables and functions?
what is mutual exclusion? How can you take care of mutual exclusion using java threads? : Java thread
What is replacefirst in java?
What type of variable is gender?
Is string is a keyword in java?
How do listeners work?
What is difference between path and classpath variables?
What is parseint?
Explain the hierarchy of java exception classes?
Describe the Big-O Notation.
What is meant by flickering?
What is temp in java?
How to split a string in java?
Are maps ordered java?
Does java support multiple inheritance or not?