Skip to content

Commit

Permalink
Example for Java 23
Browse files Browse the repository at this point in the history
  • Loading branch information
trishagee committed Dec 5, 2024
1 parent 7f4ca17 commit ea1fd54
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.jetbrains.code.jdk23;

public class PrimitiveTypesInSwitch {
private void type(Message x) {
switch (x.getStatus()) {
case 0 -> System.out.println("okay");
case 1 -> System.out.println("warning");
case 2 -> System.out.println("error");
default -> System.out.println("unknown status: " + x.getStatus());
}
}

private static class Message {
private int status;

public int getStatus() {
return status;
}
}
}

0 comments on commit ea1fd54

Please sign in to comment.