已定义类型税(java.lang.NoSuchMethodError)

时间:2018-06-02 20:47:20

标签: java eclipse

当我启动程序时:

Exception in thread "main" java.lang.NoSuchMethodError: Racuni.Tax.<init>(DLjava/lang/String;I)V
        at Racuni.dd.main(dd.java:7).

请帮忙。

public class dd {
    public static void main (String[] args) {


     Tax t = new Tax(65000,"NJ",3);
     System.out.println(t.dependents + t.grossIncome + t.state);   
    }
}
class Tax extends dd{
    double grossIncome;
    String state;
    int dependents; 



    Tax(double gi, String st, int depen){
        grossIncome= gi;
        state = st;
        dependents = depen;



     }
}

1 个答案:

答案 0 :(得分:0)

按照惯例,Java类型名称通常以大写字母开头。请将您的dd类更改为DD,因此将fileName dd.java更改为DD.java。并重新编译它应该工作正常。