java System 常用功能(获取时间,获取系统属性)

来源:互联网 发布:mac卸载mackeeper 编辑:程序博客网 时间:2024/05/16 06:53

system Api:System

1.获取时间 (返回当前时间和1970年1月1日的时间差 毫秒)
        //返回1970年1月1日到现在的时间差 (毫秒)        Long l1=System.currentTimeMillis();        System.out.println(l1);

2.确定当前的系统属性  (遍历输出)
 //确定当前的系统属性。        Long l1=System.currentTimeMillis();        System.out.println(l1);        Properties proer=System.getProperties();        Set<String> s=proer.stringPropertyNames();        for (String x:s) {            System.out.println(x+" :"+proer.get(x));        }

原创粉丝点击