主题:debug
class point {
private double x;
private double y;
private double z;
point(double -x,double -y,double -z) { 编译的时候总是显示则个构造方法
x=-x; 有问题·····怎么回事呀??
y=-y;
z=-z;
}
public void getx(double x){
x=x;
}
public void gety(double y){
y=y;
}
public void getz(double z){
z=z;
}
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))); 这个输出也有问
} 题!!!
}
我用JCreator 编译的