System类-exit()

来源:互联网 发布:淘宝客推广网站怎么建 编辑:程序博客网 时间:2024/06/06 00:49

一 exit()

exit(0) 虚拟机正常退出
exit(1)不正常退出

二 代码

利用exit()中断程序执行
/*** Created by hanshan on 2017/1/7 0007.*/public class exitDemo {    public static void main(String[] args){        System.out.println("我是小明");        System.exit(1);        System.out.println("我是小红");    }}


0 0
原创粉丝点击