package com.swift; import java.util.Scanner; public class PToP { public static void main(String[] args) { Scanner scan=new Scanner(System.in); System.out.println("请输入第一个点的坐标值x1"); Double x1=Double.parseDouble(scan.nextLine()); System.out.println("请输入第一个点的坐标值y1"); Double y1=Double.parseDouble(scan.nextLine()); System.out.println("请输入第二个点的坐标值x2"); Double x2=Double.parseDouble(scan.nextLine()); System.out.println("请输入第二个点的坐标值y2"); Double y2=Double.parseDouble(scan.nextLine()); Double distance=Math.pow((Math.pow((x2-x1),2)+Math.pow((y2-y1),2)),0.5); System.out.println("两个点之间的距离是:"+distance); } }