What is the possible way to scan a point in java ? Should I read point.x then point.y or can I read the two co-ordinates at once ?
import java.awt.Point;
import java.util.Scanner;
public class Saleelo {
public static void main(String[] args) {
int n = 5;
Scanner scan = new Scanner(System.in);
Point[] Points = new Point[60];
for (int i=0 ; i < n ; i++) {
Points[i].x = scan.nextInt();
Points[i].y = scan.nextInt();
System.out.println(Points[i]);
}
}
}
This what I have tried and it gives me null pointer exception