I\'ve been trying to initialize an array and then test its values with a class method. I have initialized the array and have already tested it successfully within the constr
In the constructor, you created a local array with the same name as the class member grid which is being shadowed by the local grid array and that is the reason for the null pointer exception since the class member was never initialized.
Simply change:
boolean[] grid = new boolean[sides]
to
grid = new boolean[sides]
This will ensure that you access the class member you want.