public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
Point point1 = new Point();
Point point2 = new Point();
double x, y;
point1.setLocation(5.0, 5.0);
point2.setLocation(1.0, 1.0);
System.out.println("请分别输入点x,y的坐标:");
x = scan.nextDouble();
y = scan.nextDouble();
boolean pdline = (x - point1.getX()) * (point1.getY() - point2.getY()) == (point1.getX() - point2.getX())
* (y - point1.getY());
if (pdline) {
System.out.println("您输入的点在该条直线上");
} else {
System.out.println("您输入的点不在该条直线上");
}
scan.close();
}