Declarations and Access Control Logic

© examsiri.com
Question : 28 of 29
 
Marks: +1, -0
Given:
1. enum Animals {
2.   DOG("woof"), CAT("meow"), FISH("burble");
3.   String sound;
4.   Animals(String s) { sound = s; }
5. }
6. class TestEnum {
7.   static Animals a;
8.   public static void main(String [] args) {
9.    System.out.println(a.DOG.sound + " " + a.FISH.sound);
10.  }
11. }

What is the result?
Go to Question: