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
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 |
What steps are taken when the OS shifts from one-thread execution to another?
According to java operator precedence, which operator is considered to be with highest precedence?
Do I need to import java.lang package any time? Why?
What class allows you to read objects directly from a stream in java programming?
Difference between stack and queue?
How to sort a collection of custom Objects in Java?
How to find the largest value from the given array.
what is use of marker interface? give me good example?
Why lambda expression is used in java?
What is definition and declaration?
How to perform bubble sort in java?
Default layout of panel and frame?