有人能帮我解决下面的代码吗?我收到错误“The method originDistance is undefined for type point”;我能做些什么来解决它?方法未定义类型
public class Test {
public static void main(String[] args) {
Point p1 = new Point(1, 1);
System.out.println(p1.originDistance());
}
int x;
int y;
public double originDistance() {
double dist = Math.sqrt(x * x + y * y);
return dist;
}
}
谢谢!
谢谢!我不知道我需要将我的方法与我的课程相匹配。 – Memory 2014-10-10 17:49:30
非常欢迎我很高兴能为您提供帮助。 – brso05 2014-10-10 17:51:08