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

What do you mean by order of precedence and associativity?

0 Answers  


Can you explain the usages of class.forname()?

0 Answers  


What makes a function well defined?

0 Answers  


What is the purpose of using java.lang.class class?

0 Answers  


What's the purpose of using break in each case of switch statement?

0 Answers  






Write a program in java to establish a connection between client and server?

0 Answers  


Can we override the static methods?

0 Answers  


Write a program to print fibonacci series up to count 10.

0 Answers  


What is the synchronized method modifier?

0 Answers  


Can final class have constructor?

0 Answers  


what is ststic with example

0 Answers   Wipro,


What are the types of methodology?

0 Answers  


Categories