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
What is arguments in java?
When a thread is executing a synchronized method , then is it possible for the same thread to access other synchronized methods of an object ?
What does the three dot emoji mean?
Which data type is class in java?
Why string is not thread safe?
What is the private method modifier?
What is a buffer in java?
What is consumer in java?
What is overriding in java?
Difference difference paint() and paintcomponent()?
Why string is not a wrapper class?
Explain the use of shift operator in java. Can you give some examples?
Explain about strings in java?
Given a singly linked list, determine whether it contains a loop or not without using temporary space?
What happens when I use / and % with a negative numerator?