关于点的问题
请大神看一下哪里出了问题,谢谢class point{
double x,y,z;
point(double _x,double _y,double _z){
x=_x;
y=_y;
z=_z;
}
void setX(double _x){
x=_x;
}
double getDistance(point p){
return(x-p.x)*(x-p.x)+(y-p.y)*(y-p.y)+(z-p.z)*(z-p.z);
}
}
public class Textpoint{
public static void main(String[] args){
point p=new point(1.0,2.0,3.0);
point p1=new point(0.0,0.0,0.0);
System.out.println(p.getDistance(p1));
}
p.setX(5.0);
System.out.println(p.getDistance(new point(1.0,1.0,1.0)));
}