有人能幫我解決下面的代碼嗎?我收到錯誤「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