Provides access to system-related information and resources including standard input and output.
System类提供对与系统相关的信息和资源的访问,包含一个标准的输入流和输出流。
Enables clients to dynamically load native libraries.
使客户(开发者)能够动态地加载本地函数库。
All methods of this class are accessed in a static way and the class itself can not be instantiated.
System类的所有方法和属性都是静态的,类本身不能被实例化。
静态块初始化静态成员
static {
err = new PrintStream(new FileOutputStream(FileDescriptor.err));
out = new PrintStream(new FileOutputStream(FileDescriptor.out));
in = new FileInputStream(FileDescriptor.in);
// 获取系统的行分隔符,此方法最终会调用initSystemProperties()方法初始化systemProperties属性
lineSeparator = System.getProperty("line.separator");
}
exit退出程序