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
Variables used in a switch statement can be used with which datatypes?
What are the Main functions of Java?
Can we create an object if a class doesn't have any constructor ( not even the default provided by constructor ) ?
Difference between class#getinstance() and new operator ?
what is static import in java? Explain
How to split arraylist elements in java?
Why deletion in linkedlist is fast than arraylist?
Why charat is used in java?
Explain list interface?
Explain about core java?
Why java is a platform independent? Explain
Why we use methods in java?
What is prefix of a string?
What is isa relationship?
What is an accessor?