filmov
tv
Java 14 Feature - Switch Expression Enhanced | Coding example | Part - 2

Показать описание
#Java14 #Switch #Expression
Code
----------------------------------
public class SwitchExpressionEnhanced {
public static void main(String[] args) {
String day = "M";
// Enhanced
String result = switch (day) {
case "M", "W", "F" - grether than sign "MWF";
case "T", "TH", "S" - grether than sign "TTS";
default - grether than sign {
yield "Please insert a valid day.";
else
yield "Looks like a Sunday.";
}
};
}
}
Instagram: techtalk_debu
if you like my video, please subscribe to my channel and share the video
Thanks & Regards,
Debu Paul
Code
----------------------------------
public class SwitchExpressionEnhanced {
public static void main(String[] args) {
String day = "M";
// Enhanced
String result = switch (day) {
case "M", "W", "F" - grether than sign "MWF";
case "T", "TH", "S" - grether than sign "TTS";
default - grether than sign {
yield "Please insert a valid day.";
else
yield "Looks like a Sunday.";
}
};
}
}
Instagram: techtalk_debu
if you like my video, please subscribe to my channel and share the video
Thanks & Regards,
Debu Paul