【异常-举例1:开发人员不做处理,JVM会怎么处理】

如果程序出现了问题,我们没有做任何处理,最终jvm会做出默认的处理。
把异常的名称,原因及出现的问题等信息输出在控制台。
同时会结束程序。

package com.shusheng.tihuzhai.test;

/**
 * @author shusheng
 * @description
 * @Email shusheng@yiji.com
 * @date 2018/10/9 16:06
 */
public class ExceptionDemo1 {
    public static void main(String[] args) {
        //第一阶段
        int a = 10;
        int b = 0;
        System.out.println(a/b);
        //第二阶段
        System.out.println("over");
    }
}

运行结果:

Exception in thread "main" java.lang.ArithmeticException: / by zero
    at com.shusheng.tihuzhai.test.ExceptionDemo1.main(ExceptionDemo1.java:15)
终身学习者
原文地址:https://www.cnblogs.com/zuixinxian/p/9760928.html