DF
Size: a a a
DF
DF
DF
DS
DF
DF
DF
DF
DF
DS
DF
EG
p
p
AZ
AZ
Т8
Т8
var operation = 2;
var result = operation switchJava
{
1 => "Case 1",
2 => "Case 2",
3 => "Case 3",
4 => "Case 4",
_ => "No case availabe"
};
boolean result = switch(ternaryBool) {
case TRUE -> true;
case FALSE -> false;
case FILE_NOT_FOUND -> throw new UncheckedIOException(
"This is ridiculous!",
new FileNotFoundException());
// as we'll see in "Exhaustiveness", `default` is not necessary
default -> throw new IllegalArgumentException("Seriously?!");
};
Т8
Т8