Java System系统类的常用方法

system代表当前系统。
静态方法:
1.public static void exit(int status) :终止JVM虚拟机,非0是异常终止。

//终止当前虚拟机
        System.exit(0);

2.public static long currentTrimeMillis() :获取当前系统此刻时间毫秒值。

        long time = System.currentTimeMillis();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String format = sdf.format(time);
        System.out.println(format);//2020-06-27 19:13:16
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章