Why is this int switch valid:
public class Foo {
private final static int ONE = 1;
private final static int TWO = 2;
public static void main(String
The compiler says
unqualified enumeration constant name required
So your value of RT
would need to be RUNTIME
instead of RetentionPolicy.RUNTIME
to make your code work. But of course that is not possible. Why not use the RetentionPolicy
enum directly? If you want to stick to your final static declaration, you need to assign the whole enum to your final static variable.