各位大虾,帮我看一下下面的程序哪错了,谢了!!

2024-12-16 08:17:34
推荐回答(1个)
回答1:

各位大虾,帮我看一下下面的程序哪错了,谢了!!
悬赏分:10 - 离问题结束还有 14 天 23 小时
public class Point{
int x,y,z;
Point(int x,int y)
{this.x=x;
this.y=y;
}

point3d(int x,int y,int z)
{
this.x=x;
this.y=y;
this.z=z;
}

public double distance()
{
return Math.sqrt(x*x+y*y);
}
static void main(String[]args){
Point p=new Point(1,1);
System.out.println("p.distance = " +p.distance());
Point3d pt=new Point3d();
pt.point3d(1,1,1);
System.out.println("p.distance() = " +pt.distance());