R
richnjones
Consider these three class definitions in package core
1 package core;
2
3 enum PLANET {
4 MARS
5 }
6
7 public class A {
8 }
1 package core;
2
3 enum PLANET {
4 VENUS
5 }
6
7 public class B {
8 }
1 package core;
2
3 public class A {
4 public static void main(String... s) {
5 PLANET p = PLANET. //here
6 }
7 }
I appear to have created to default access enums called the same thing
but with different values. In which case I believe them to have the
same fully qualified name (core.PLANET) Im not sure how this is
compiling. It is though and my confusion is compounded by the fact
that the PLANET enum used by the //here comment resolves to the enum
in class A. Why does it choose that one?
TIA
Richard
1 package core;
2
3 enum PLANET {
4 MARS
5 }
6
7 public class A {
8 }
1 package core;
2
3 enum PLANET {
4 VENUS
5 }
6
7 public class B {
8 }
1 package core;
2
3 public class A {
4 public static void main(String... s) {
5 PLANET p = PLANET. //here
6 }
7 }
I appear to have created to default access enums called the same thing
but with different values. In which case I believe them to have the
same fully qualified name (core.PLANET) Im not sure how this is
compiling. It is though and my confusion is compounded by the fact
that the PLANET enum used by the //here comment resolves to the enum
in class A. Why does it choose that one?
TIA
Richard