1.

⇒ Write a Java program to input a character from the user and display the days of the week according to the users choice. (For Sunday ,let the character be S )

Answer»

public static void MAIN(String s[]) { int day = 2; SWITCH(day) { case 1: System.out.println("Monday"); break; case 2: System.out.println("Tuesday"); break; case 3: System.out.println("Wednesday"); break; case 4: System.out.println("Thursday"); break; case 5: System.out.println("Friday"); break; default: System.out.println("Weekend"); break; } }}



Discussion

No Comment Found