-1
class PointInPlane {
public float x;
public float y;
static class CircleInPlane {
public static float r;
public static float xcentr;
public static float ycentr;
static void solve(PointInPlane a, PointInPlane b, PointInPlane c) {
float A = (b.y-a.y)/(b.x-a.x); //geting NullPointerExeption
float B = (c.y-b.y)/(c.x-b.x); //probably will get in all next steps
xcentr = (A*B*(a.y-c.y)+B*(a.x+b.x)-A*(b.x+c.x))/(2*(B-A));
ycentr = A*(xcentr-a.x)+a.y;
r = sqrt((pow((a.x - xcentr), 2) + pow((a.y - ycentr), 2)));
}
}
}
所以IDK我該如何處理這個問題。我得到NullPointerExeption時申報浮動答:我認爲問題是,我使用的字段從一個類在另一個或試圖使用PointInPlane對象a,b和c與空字段。這個問題如何解決?當使用另一個類中的屬性時,NullPointerExeption
'A'或'B'是'null'。 – luk2302
告訴你如何調用'解決()'方法和賦值您使用參數.. –
@ luk2302 - 或兩者 –