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 Test {
public static void main (String[] args){
Point p=new Point(1.0 , 2.0 , 3.0) ;
Point p1=new Point (2.0 , 3.0 , 4.1);
System.out.println(p.getDistance(p1));
}
}
看马士兵老师的视频的时候有段这个代码 打出来但是总是错误
Exception in thread "main" java.lang.NoSuchMethodError: Point.<init>(DDD)V
at Test.main(Test.java:20)
求助各位大牛
public class TestPoint {
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));