enum Animals{
DOG("woof"),
CAT("Meow"),
FISH("Burble");
String sound;
Animals(String s) {
sound = s;
}
}
public class TestEnum{
static Animals a;
public static void main(String ab[]){
System.out.println( a );
System.out.println( a.DOG.sound + " " + a.FISH.sound);
}
}
In the above example, why are we able to access instances of the enum (i.e. as a.DOG.sound) when a
is null and enum is not declared as static?
Are the enum instances static by default?