I have a problem with this piece of code:
PointerCoords[][]srodki = new PointerCoords[n2][];
for(int i = 0; i < n2; i++)
{
srodki[i] = new PointerCoords[n2];
}
for(int i = 0; i < n2; i++)
{
for(int j = 0; j < n2; j++)
{
srodki[i][j].y = r + j*k;
srodki[i][j].x = r + i*k;
}
}
Why do I get a NullPointerException?
The problem is that you didn’t initialize the content of
srodki[i][j]before performing the insertion:So first, you need to perform:
and then it shall be ok.