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


Please Help Members By Posting Answers For Below Questions

What is a method declaration?

509


Can we store variables in local blocks?

782


How listener identify that the event came from a particular object?

1467


What are the differences between stringbuffer and stringbuilder?

536


What is the nested interface?

593






What is the use of accept () method in java?

606


What is the difference between Grid and Gridbaglayout?

576


What is the technique adopted to create an immutable class?

522


Explain what is encapsulation?

602


What is an arraylist in java?

513


What is arrays aslist in java?

513


Does set allows null in java?

505


What is the program compilation process?

584


Is final static java?

545


Why deletion in linkedlist is fast than arraylist?

533