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



10. class Nav{ 11. public enum Direction { NORTH, SOUTH, EAST, WEST } 12. } 13. public class Spri..

Answer / neil

Nav.Direction d = Nav.Direction.NORTH;

Is This Answer Correct ?    33 Yes 1 No

10. class Nav{ 11. public enum Direction { NORTH, SOUTH, EAST, WEST } 12. } 13. public class Spri..

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

Post New Answer

More Core Java Interview Questions

Where is const variable stored?

0 Answers  


is memory to the abstract class allocated ..or objects not instantiated

7 Answers   Synechron, TCS,


Can we execute java program without main method?

0 Answers  


What is an object class?

0 Answers  


List the interfaces which extends collection interface?

0 Answers  






What is the escape character in java?

0 Answers  


what is the use of clone method? why user cant overwrite in sub class without its proper defination.

2 Answers   TCS,


explain about method overloading and method overriding with difficult examples

4 Answers  


What is the default value of byte datatype in java?

0 Answers  


What is the equal sign?

0 Answers  


What is difference between char array and string?

0 Answers  


What is the byte range?

0 Answers  


Categories