gatas
asked on
NullPointer Exception when i try to access array..
Hi there...
I ve got the following class where the array is initialized in the class' constructor..
public class Board {
public Cell board[][] ;
Board(int x)
{
board=new Cell[x][x] ;
}
Is the above correct?
When i try to access the board array after i declare a Board object
for example: a.board[0][1].someMethod()
I get java.lang.NullPointerExcep tion..
I am a java newb so any help would be appreciated..
I ve got the following class where the array is initialized in the class' constructor..
public class Board {
public Cell board[][] ;
Board(int x)
{
board=new Cell[x][x] ;
}
Is the above correct?
When i try to access the board array after i declare a Board object
for example: a.board[0][1].someMethod()
I get java.lang.NullPointerExcep
I am a java newb so any help would be appreciated..
YOu have to fill all the array elements too with Cell objects
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.