mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-29 13:48:49 +07:00
GitOrigin-RevId: 411e4842d0ecf8cf4db0308f854e179dee46ced3
25 lines
851 B
Java
25 lines
851 B
Java
// "Replace with enhanced 'switch' statement" "true-preview"
|
|
class X {
|
|
private static void test(String... commands) {
|
|
for (String command : commands) {
|
|
switch (command) {
|
|
case "Say hello" ->
|
|
// line contains no height
|
|
System.out.printf("Hello, %s!%n", System.getProperty("user.name"));
|
|
case "Exit" ->
|
|
// line contains no code
|
|
System.out.println("Goodbye.");
|
|
case "Multiline" -> {
|
|
// a
|
|
System.out.println("a");
|
|
// b
|
|
System.out.println("b");
|
|
// c
|
|
System.out.println("c");
|
|
}
|
|
default -> // line contains code at second position and height
|
|
System.out.println(command);
|
|
}
|
|
}
|
|
}
|
|
} |