Java入门——System类
System类简介
System类是一些与系统相关的属性和方法的集合,而且所有属性都是静态的。
序号 | 方法定义 | 类型 | 描述 |
1 | public static void exit(int static) | 普通 | 系统退出,如果status为非0就表示退出 |
2 | public static void gc() | 普通 | 运行垃圾回收机制,调用的是Runtime类的gc()方法 |
3 | public static long currentTimeMills() | 普通 | 返回以毫秒为单位的当前时间 |
4 | public static Properties getProperties() | 普通 | 取得当前系统的全部属性 |
5 | public static String getProperties() | 普通 | 根据键值取得属性的具体内容 |
package Sep26; public class SystemDemo01 { public static void main(String[] args) { System.getProperties().list(System.out); } }
-- listing properties -- java.runtime.name=Java(TM) SE Runtime Environment sun.boot.library.path=/Library/Java/JavaVirtualMachines/jdk... java.vm.version=25.101-b13 gopherProxySet=false java.vm.vendor=Oracle Corporation java.vendor.url=http://java.oracle.com/ path.separator=: java.vm.name=Java HotSpot(TM) 64-Bit Server VM file.encoding.pkg=sun.io user.country=CN sun.java.launcher=SUN_STANDARD sun.os.patch.level=unknown java.vm.specification.name=Java Virtual Machine Specification user.dir=/Users/mac/Documents/workspace/JAVA/Domo java.runtime.version=1.8.0_101-b13 java.awt.graphicsenv=sun.awt.CGraphicsEnvironment java.endorsed.dirs=/Library/Java/JavaVirtualMachines/jdk... os.arch=x86_64 java.io.tmpdir=/var/folders/t4/8fdnrsn903vbqf420xlgd... line.separator= java.vm.specification.vendor=Oracle Corporation os.name=Mac OS X sun.jnu.encoding=UTF-8 java.library.path=/Users/mac/Library/Java/Extensions:/L... java.specification.name=Java Platform API Specification java.class.version=52.0 sun.management.compiler=HotSpot 64-Bit Tiered Compilers os.version=10.11.6 user.home=/Users/mac user.timezone= java.awt.printerjob=sun.lwawt.macosx.CPrinterJob file.encoding=EUC_CN java.specification.version=1.8 user.name=mac java.class.path=/Users/mac/Documents/workspace/JAVA/D... java.vm.specification.version=1.8 sun.arch.data.model=64 java.home=/Library/Java/JavaVirtualMachines/jdk... sun.java.command=Sep26.SystemDemo01 java.specification.vendor=Oracle Corporation user.language=zh awt.toolkit=sun.lwawt.macosx.LWCToolkit java.vm.info=mixed mode java.version=1.8.0_101 java.ext.dirs=/Users/mac/Library/Java/Extensions:/L... sun.boot.class.path=/Library/Java/JavaVirtualMachines/jdk... java.vendor=Oracle Corporation file.separator=/ java.vendor.url.bug=http://bugreport.sun.com/bugreport/ sun.cpu.endian=little sun.io.unicode.encoding=UnicodeBig sun.cpu.isalist=
时间: 2024-10-10 10:28:48