I have a very simple question but i can\'t figure out why I\'m having this exception. I\'m trying to create a 2-dimensional Array of objects for a sudoku puzzle, but when I\'m i
You should move your grid initialization into the make grid method since in the constructor the member lines
is still not initialized with your desired value (default value of int is 0 so you get an empty array and you try to access it afterwards with bigger unallocated bounds)
public void makeGrid(int size) {
this.lines = size; // If you do not need lines anywhere else then it is redundant
grid = new Cell[size][size];
for(int i=0;i