传了也报错:Exception in thread "main" java.lang.Error: Unresolved compilation problem: Unhandled exception type MyException at RegistStudent.main(RegistStudent.java:23)
public static void main(String[] args) throws Exception { RegistStudent t=new RegistStudent(); t.regist(3);/*若加入此步系统报错:Exception in thread "main" java.lang.Error: Unresolved compilation problem: The method regist(int) in the type RegistStudent is not applicable for the arguments ()at RegistStudent.main(RegistStudent.java:23)*/ t.manager(); } 改成这样,一你没有传参,而传参后你没有处理异常,要么扔给控制台,要么catch掉
public static void main(String[] args) throws MyException
Unhandled exception type MyException at RegistStudent.main(RegistStudent.java:23)
{
RegistStudent t=new RegistStudent();
t.regist(3);/*若加入此步系统报错:Exception in thread "main" java.lang.Error: Unresolved compilation problem: The method regist(int) in the type RegistStudent is not applicable for the arguments ()at RegistStudent.main(RegistStudent.java:23)*/
t.manager();
}
改成这样,一你没有传参,而传参后你没有处理异常,要么扔给控制台,要么catch掉