You could put them into an array.
Point[] origin = new Point[n];
for (int i = 0; i < n; i++) {
origin[i] = new Point(x, y);
}
They'd all be using the same x
and y
under those conditions.
If you had an array of x
and y
you could do it like this:
Point[] origin = new Point[n];
for (int i = 0; i < n; i++) {
origin[i] = new Point(x[i], y[i]);
}
If you don't like arrays, you could use a list:
List<Point> origin = new ArrayList<>();
for (int i = 0; i < n; i++) {
origin.add(Point(x[i], y[i]));
}
You'd address them as
origin.get(i)