fred rosenberger wrote:
Do you actually get to the "board [i][j]= "-"; " line? I would think (and this is a guess) that you get the NPE on line 4 here. you are trying to get the length of an array that doesn't exist.>
fred rosenberger wrote:a line like this:
String [][] board= new String [3][3];
creates an array, but it has nothing in it.
Also..remember that java doesn't have multi-dimensional arrays. it has arrays that hold objects - and those objects can be arrays.
So, after this line, you have an array that can hold three things (which have to be arrays of String), but those things don't exist yet. So you can't call a method on them.