To print days of week using switch case in java

CODE :

class P_03_print_day_switch_case_part3 {
public static void main(String[] args) {
int a=1;
switch (a) {
case 0:
System.out.println("Today is Monday");
break;
case 1:
System.out.println("Today is Tuesday");
break;
case 2:
System.out.println("Today is Wednesday");
break;
case 3:
System.out.println("Today is Thursday");
break;
case 4:
System.out.println("Today is Friday");
break;
case 5:
System.out.println("Today is Saturday");
break;
case 6:
System.out.println("Today is Sunday");
break;
default:
System.out.println("You are doomed");
}
}

}

Output : 



Comments

Popular posts from this blog

To create an html page with frames and frameset

1. Write a program to insert a new element at end as well as at a given position in an array in Java

1. To familiarize with network devices like switch, hub, routers and bridges in LaTex