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 |
How would you convert bytes to string?
What about anonymous inner classes in java?
how many types of Inheritance?
Can you access the private method from outside the class?
system.out.println(1 + 3);
What are the 2 types of java programs?
What is the purpose of the File class?
How to find the length and capacity of a string buffer ?
What is a flag value?
What is singleton pattern?
What is the properties class in java programming?
What is == in java?