Wednesday, December 19, 2007

Interesting java compiler errors#1

public class Test2 {
public enum Dogs {collie, harrier, shepherd};
public static void main(String [] args) {
Dogs myDog = Dogs.shepherd;
switch (myDog) {
case Dogs.collie:
System.out.print("collie ");
default:
System.out.print("retriever ");
case harrier:
System.out.print("harrier ");
}
}
}
what is the error?
an enum switch case label must be the unqualified name of an enumeration constant

No comments: