java 14 switch statement code example
Example: java 14 switch
switch (event) {
case PLAY -> {
System.out.println("PLAY event!");
counter++;
}
case STOP -> System.out.println("STOP event");
default -> System.out.println("Unknown event");
};
switch (event) {
case PLAY -> {
System.out.println("PLAY event!");
counter++;
}
case STOP -> System.out.println("STOP event");
default -> System.out.println("Unknown event");
};