Answers for "java jagged array days and months"

0

java jagged array days and months

int[][] CalendarDays = new int[12][];

for(int i = 1; i <= 12; i++) {
  	// months with 30 days
	if(i == 4 || i == 6 || i = 9 || i == 11) {
		CalendarDays[i] = new int[30];
    // months with 28 days
	} else if(i == 2) {
		CalendarDays[i] = new int[28];
    // months with 31 days
	} else {
		CalendarDays[i] = new int [31];
	}
}
Posted by: Guest on February-18-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language