0
基本上,我試圖寫一個程序,讓你一元二次方程的判別與三個變量。然而,當我嘗試創建一個具有我的二次方b和c值的對象時,它說我沒有創建該對象。我也是新手,所以如果我做了明顯錯誤的事情,請原諒我。判別發現程序
這是錯誤,我得到。
異常在線程 「主」 了java.lang.RuntimeException:不可編譯的源代碼 - 錯誤的樹類型: 在quadratic.equation.solver.QuadraticEquationSolver.main(QuadraticEquationSolver.java:38) Java結果:1
以下是代碼。
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package quadratic.equation.solver;
/**
*
* @author User
*/
public class QuadraticEquationSolver {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
class Quadratic {
int aValue;
int bValue;
int cValue;
public Quadratic(int A, int B, int C) {
aValue = A;
bValue = B;
cValue = C;
}
public int calculateDiscriminant(int A, int B, int C) {
int answer = ((bValue*bValue)+(-4*aValue*cValue));
return answer;
}
Quadratic firstQuad = new Quadratic(7, 5, 3);
}
System.out.println(firstQuad.calculateDiscriminant);
}
這編譯? firstQuad存在於主要上下文中? .. – nachokk
這從來沒有編譯。 –