I am fairly new to Java, I've looked all over the Internet and stackoverflow itself to understand what I am doing wrong to no luck. Can someone please tell me why I get this error? I think I've initialized the array the right way and I think I've instantiated it right as well.
public class Grid {
private Slot[][] array = new Slot[12][12];
public Grid(){};
public void printarray(){
for(int i = 1 ; i <= 10 ; i++){
System.out.print(i + "|" + "");
for(int j = 1 ; j <= 10 ; j++){
System.out.print(array[i][j].getStatus());
}//end inner for
System.out.print("\n");
}//end outer for
System.out.print("\n");
};
}//end of class
public class Slot {
public Slot(){};
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
private int status = 0 ;
private int id = 0 ;
}//end of slot
public static void main(String[] args) {
Grid myGrid = new Grid();
myGrid.printarray();
}//end of main