If we take this code as an example :
switch (PeriodEnum.getEnum(month).getValue()) {
case 0: // Calendar.JANUARY
case 2: // Calendar.MARCH
case 4: // Calendar.MAY
case 6: // Calendar.JULY
case 7: // Calendar.AUGUST
case 9: // Calendar.OCTOBER
case 11: // Calendar.DECEMBER
nbDays = 31;
break;
case 3: // Calendar.APRIL
case 5: // Calendar.JUNE
case 8: // Calendar.SEPTEMBER
case 10: // Calendar.NOVEMBER
nbDays = 30;
break;
What is the difference between the previous code and the code below?
switch (PeriodEnum.getEnum(month).getValue()) {
case 0: // Calendar.JANUARY
nbDays = 30;
break;
case 2: // Calendar.MARCH
nbDays = 30;
break;
case 4: // Calendar.MAY
nbDays = 30;
break;
....
}
As a beginner in java , I would love to understand the difference . The main thing I don't understand is how the IDE will detect the case based on the month and associate it?
Thank you