I am writing a program in Java, in which I define a class
class Point
{
double x;
double y;
}
Then in a method, I define an array of points, as follows:
Point[] line = new Point[6];
In the same method, I have the line
line[SampleSize - i + 1].x = i;
The first time this statement is hit, the value of its array index is 1; but the program throws a null pointer exception at this point.
This would seem like the correct way to index the field of an object within an array of objects. What am I doing wrong?
Thanks in advance for any suggestions.
John Doner