Switch Expressions in Java Get link Facebook X Pinterest Email Other Apps May 09, 2020 int month=5; String monthString; monthString = switch (month) { case 1 -> "January"; case 2 -> "February"; case 3 -> "March"; case 4 -> "April"; case 5 -> "May"; case 6 -> "June"; case 7 -> "July"; case 8 -> "August"; case 9 -> "September"; case 10 -> "October"; case 11 -> "November"; case 12 -> "December"; default -> "Invalid month"; }; System.out.println(monthString);Comment Get link Facebook X Pinterest Email Other Apps Comments
Comments
Post a Comment