PotatoeMasher
Member
Hey guys... been a while since I did anyhting significant in Java and I've been using Python lately, so I think that explains why I'm having trouble...
Can anyone tell me why this code throws a null pointer exception?
If I manually set the coords, it works fine--but it fails on grid[0][0] if the variables are supplied by the for loop...
EDIT: I feel like an idiot...
Can anyone tell me why this code throws a null pointer exception?
Code:
String[][] newgrid = new String[13][9];
for (int x=0;x<13;x++){
for (int y=0;y<9;y++){
grid[x][y]=".";
}
}
If I manually set the coords, it works fine--but it fails on grid[0][0] if the variables are supplied by the for loop...
EDIT: I feel like an idiot...