I get this null pointer exception error if i call a method. if (farm1.cropStat(row, col) )
here's the method
public boolean cropStat(int row, int col)
{
if( !( field1[row][col].harvested ) && field1[row][col] != null )
{
return true;
}
else
{
return false;
}
}
here's the initialization
public void initializeCrops()
{
Random rnd = new Random();
int rRow=-1, cCol=-1;
int i, j;
for (i = 0; i< 74; i++)
{
while(rRow <0 || cCol <0)
{
rRow = rnd.nextInt() % 104;
cCol = rnd.nextInt() % 104;
}
field1[rRow][cCol] = new Crops(rRow, cCol);
}
}
pls help :(