You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

HelloWorldEnumSwitch.java 277B

12345678910111213141516171819202122
  1. public class HelloWorldEnumSwitch {
  2. public static void main(String[] args) {
  3. switch(TestEnum.A) {
  4. case A:
  5. System.out.println("A");
  6. break;
  7. case B:
  8. System.out.println("B");
  9. }
  10. }
  11. public static enum TestEnum {
  12. A,
  13. B;
  14. private TestEnum() {
  15. }
  16. }
  17. }