Java 7 : Using String in switch statement

At last java 7 started supporting String object as a parameter to switch statement. Previously it was numbers and enumerations. I am sure this will be a welcoming change to the Java community. [code] public class WeekTeller { public static void main (String [] args) { String weekCode = args[0]; switch (weekCode) { case "M": { System.out.println("Monday"); break; } case "T": { System.out.println("Tuesday"); break; } case "W": { System.out.println("Wednesday"); break; } case... more →
Posted in: Java, Programming