java jagged array days and months

Solutions on MaxInterview for java jagged array days and months by the best coders in the world

showing results for - "java jagged array days and months"
Allison
23 May 2019
1int[][] CalendarDays = new int[12][];
2
3for(int i = 1; i <= 12; i++) {
4  	// months with 30 days
5	if(i == 4 || i == 6 || i = 9 || i == 11) {
6		CalendarDays[i] = new int[30];
7    // months with 28 days
8	} else if(i == 2) {
9		CalendarDays[i] = new int[28];
10    // months with 31 days
11	} else {
12		CalendarDays[i] = new int [31];
13	}
14}