一般出现这种情况,要么是没写";"分号,要么错用了中式的分号
例如:
public static void main(String[] args)
{
int a = 1;
int b = 0;
try{//监控区域
//System.out.println(a/b);
test newa();
}catch(ArithmeticException e){ //捕获异常
System.out.println("ArithmeticException");
}catch(Exception e){
System.out.println("Excpetion");
}
}
public void a(){b()}
public void b(){a()}
上面的代码中,a、b方法中的语句后面都没带;分号,编译运行后就会提示:需要“;”