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 ?    34 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

What is the purpose of default constructor?

1 Answers  


How will you add panel to a frame?

1 Answers  


What technique is carried out to find out if a particular string is empty?

1 Answers  


How does the garbage collector works in java?

1 Answers   Cyient,


What are different type of exceptions in java?

1 Answers  


Describe what happens when an object is created in java ?

1 Answers  


Why are parameters used in functions?

1 Answers  


why we import both packages java.awt.*; and java.awt.event.*; as java.awt.*; can import all classes na. then what is the need of importing java.awt.event.*; ?

3 Answers  


Why is boolean important?

1 Answers  


can we add two numbers without using arthematic operators? if possible how?

5 Answers   CTS,


What is output buffer?

1 Answers  


What is charat ()?

1 Answers  


Categories