Files
2023-07-05 12:09:22 +00:00

23 lines
522 B
Java

// "Remove unreachable branches" "true-preview"
import java.util.concurrent.ThreadLocalRandom;
class Test {
void test(Number n) {
n = 1;
switch (n) {
case <caret>Integer i when i == 1 -> {
int rand = ThreadLocalRandom.current().nextInt();
if (rand > 10) {
i = 2;
}
else {
i = 3;
}
System.out.println(i);
}
case Long s -> System.out.println(s);
default -> System.out.println();
}
}
}