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 arguments in java?

509


When a thread is executing a synchronized method , then is it possible for the same thread to access other synchronized methods of an object ?

600


What does the three dot emoji mean?

574


Which data type is class in java?

545


Why string is not thread safe?

526






What is the private method modifier?

566


What is a buffer in java?

564


What is consumer in java?

515


What is overriding in java?

509


Difference difference paint() and paintcomponent()?

522


Why string is not a wrapper class?

636


Explain the use of shift operator in java. Can you give some examples?

531


Explain about strings in java?

605


Given a singly linked list, determine whether it contains a loop or not without using temporary space?

575


What happens when I use / and % with a negative numerator?

531