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.
12345678910111213 |
- /**
- * Inspired by examples in https://openjdk.java.net/jeps/420
- */
- public class SwitchPatternPreview3Error1 {
- static void constantLabelsMustAppearBeforePatterns1(Integer i) {
- switch (i) {
- case null -> System.out.println("value unavailable: " + i);
- case Integer value when value > 0 -> System.out.println("positive integer: " + i);
- case -1, 1 -> System.out.println("absolute value 1: " + i);
- default -> System.out.println("other integer: " + i);
- }
- }
- }
|