I initially want to say thank you for taking the time to look at my post. Basically I have attempted to create a multidimensional array with random integers using Math.random. The code compiles and keeps returning the null pointer exception error message. I don't know what I did wrong in creating my object. Can anyone tell me what's wrong with the code?
public Table(int r, int c)
{
rows = r;
columns = c;
for (int i = 0; i < r; i++)
for (int j = 0; j < c; j++)
{
/*
* Here is where the error keeps returning, blueJ keeps pointing
* me to this line of code and it has to be the variables I am using
* in the array that are causing the issue. The only issue is I * don't know what to insert for that.
*/
theTable[i][j] = (int)(100*Math.random());
}
}