What are switch expressions introduced in Java 12?
January 23, 2025
Switch expressions allow the switch statement to return a value and support lambda-like syntax:
int day = switch (input) {
case 1, 2, 3 -> input + 10;
default -> 0;
};
Currently Empty: ₹0.00
Switch expressions allow the switch statement to return a value and support lambda-like syntax:
int day = switch (input) {
case 1, 2, 3 -> input + 10;
default -> 0;
};
Whether to upskill or for any other query, please drop us a line and we'll be happy to get back to you.
Please leave us your contact details and our team will call you back.