public class TestException5 { public static void main(String[] args) { int a=3; int b=0; try{ if(b==0)throw new ArithmeticException( ); System.out.println('a/b的值是:+a/b'); } catch(ArithmeticException e){ System.out.println('程序异常,b不能是0'); } System.out.println('运行结束'); }
}
运行时报下面的异常
=====================================================================
Exception in thread "main" java.lang.Error: Unresolved compilation problem: Invalid character constant
at gu.com.TestException5.main(TestException5.java:9)
==================================
Invalid character constant 无效的字符常量
超低级的错误,输出的括号内应该用双引号