I get a NullPointerException at line 14 the one that says:
points[i].x = new Random().nextInt(30);
My full Code:
import java.util.Random;
public class RandomPoints {
public class Point {
public int x;
public int y;
}
public static void main(String[] args) {
Point[] points = new Point[100];
for(int i = 0; i < points.length; i++) {
points[i].x = new Random().nextInt(30);
points[i].y = new Random().nextInt(30);
System.out.println(points[i].x + " " + points[i].y);
}
}
}