本人java菜鸟一只,望各位大虾给看看,这程序 找不到符号的错误 是怎么回事i先谢过了!
package Mypoint;class Point
{
public int x;
public int y;
public void Point(int a,int b)
{
this.x=a;
this.y=b;
}
public void display()
{
System.out.println("您创建了一个X坐标为:"+x+",Y坐标为:"+y+"的点("+x+","+y+")");
System.out.println("--------------------------------");
}
}
import java.util.Scanner;
class PointDemo
{
public static void distance(Point a,Point b)
{
float m;
m=(float) Math.sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
System.out.println("这两个点之间的距离为:"+m);
}
public static void main(String[] args)
{
System.out.println("本程序要实现的是计算两点之间的距离,点由用户来进行输入-----");
Scanner A=new Scanner(System.in);
Scanner B=new Scanner(System.in);
Scanner C=new Scanner(System.in);
Scanner D=new Scanner(System.in);
System.out.println("请输入第1.个点:");
int a,b;
a=A.nextInt();
b=B.nextInt();
Point p1=new Point(a,b);
p1.display();
System.out.println("请输入第2.个点:");
int c,d;
c=C.nextInt();
d=D.nextInt();
Point p2=new Point(c,d);
p2.display();
distance(p1,p2);
}
}