rt.jar/java.lang包下
源码类public final class System认识
System类 概念:表示系统类 类常量:out,err 类方法: 获取当前时间戳: currentTimeMillis(1秒=1000毫秒) 获取当前纳秒: nanoTime(1纳秒=0.000001毫秒) 获取系统环境相关: getenv 获取系统属性: getProperties,getProperty 数组复制: arraycopy 程序退出: exit(0是正常退出,非0是非正常退出) 垃圾回收: gc
类方法这里只介绍其中部分常用方法
public static native long currentTimeMillis() public static native long nanoTime() public static java.util.Map例子getenv() public static String getenv(String name) public static Properties getProperties() public static String getProperty(String key) public static native void arraycopy(Object src, int srcPos,Object dest, int destPos,int length) public static void exit(int status) public static void gc()
//类常量:out,err
System.out.print("HelloWorld");
System.out.println();
System.out.printf("test %d %s", 1,"test");
System.out.println();
System.err.print("HelloWorld");
System.err.println();
System.err.printf("test %d %s", 1,"test");
System.err.println();
//获取当前时间戳
System.out.println(System.currentTimeMillis());
//获取当前纳秒
System.out.println(System.nanoTime());
//获取系统环境相关
Map map = System.getenv();
for (Entry entry : map.entrySet()) {
System.out.println(entry.getKey() + " => " + entry.getValue());
}
System.out.println("MAVEN_HOME " + System.getenv("MAVEN_HOME"));
//获取系统属性
for (Entry 


