public class TestingGen {
    /**
     * @param args
     */
    public enum Types {
        TYPE1("TYPE1"), TYPE2("TYPE2");
        private String type;
        private Types(String type) {
            this.type = type;
        }
        public String getType() {
            return type;
        }
    }
    public static void main(String[] args) {
        String value = null;
        switch (value) {
        case Types.TYPE1.getType():
            System.out.println("here");
            break;
        case Types.TYPE2.getType():
            System.out.println("there");
        default:
            System.out.println("default");
        }
    }
}
Its showing errors on both the case statements "case expressions must be constant expressions".
How can I use String enums in swtich statement then ?
 
     
    