示例代码2: public class TestInfo { private static int m = 0; public static void main(String[] args) { System.out.println("test exception"); try { m = 899/0; } catch (Exception e) { System.out.println(e.toString()); System.out.println(e.getMessage()); } } } 输出结果: java.lang.ArithmeticException: / by zero / by zero