import
java.util.Scanner;
public
class
TestObject {
public
static
void
main(String[] args) {
// TODO Auto-generated method stub
Scanner in =
new
Scanner(System.in);
System.out.println(
"请输入第一个坐标点:"
);
int
x1 = in.nextInt();
int
y1 = in.nextInt();
System.out.println(
"请输入第二个坐标点:"
);
int
x2 = in.nextInt();
int
y2 = in.nextInt();
int
distance = (
int
) Math.sqrt(Math.abs((x1 - x2)*(x1 - x2))+Math.abs((y1 - y2)*(y1 - y2)));
System.out.println(
"两点间距离是:"
+distance);
}
}
时间: 2024-11-05 18:54:20