Question: Given: int month = 1 1 ; switch ( month ) { case 1 : case 3 : case 5 : case 7 : case

Given:
int month =11;
switch(month){
case 1: case 3: case 5: case 7:
case 8: case 10: case 12:
String message ="31 days. ";
System.out.print(message);
case 4: case 6: case 9: case 11:
String message ="30 days. ";
System.out.print(message);
case 2:
String message ="28 days. ";
System.out.print(message);
}
What is the output of this code?
30 days. 28 days.
Does not print because of compilation error
31 days. 30 days.
30 days.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!