I'm having trouble initializing an array. When I try to draw the Array I'm getting a NullPointerException.
I need to access the class where I've declared the array from another class, that's why it's static.
Here's my code:
static int[][] DayOfTheMonth = new int[3][10];
public static void ArrayValue() {
for (int column = 0; DayOfTheMonth.length < 4; column++) {
for (int row = 10; DayOfTheMonth[column].length < 10; row++) {
if (DaysofTheMonth <= Tag.MaximumDaysOfAMonth()) {
DayOfTheMonth.[column][row] = Date.getDate() + DaysofTheMonth;
DaysofTheMonth++;
} else if (DaysofTheMonth > Tag.MaxDay()) {
DaysofTheMonth = 1;
if (Month != 12)
Month++;
else {
Month = 0;
Year++;
}
}
}
}
}
Another problem is that, when I try to access the method trough my main class, it says:
Exception in thread "Main" java.lang.ArrayIndexOutOfBoundsException: 3