The following code compiles:
public enum Foo {
A,
B{};
public static void main(String[] args) {
Foo f = Foo.A;
List s = (List)f;
}
}
This one doesn't:
public enum Foo {
A,
B;
public static void main(String[] args) {
Foo f = Foo.A;
List s = (List)f;
}
}
I could also replace Foo.A
with Foo.B
and get the same result.
What is going on here? How could Foo.A
ever be a List
in the first example?