首页 > 代码库 > Java入门——System类

Java入门——System类

Java入门——System类



System类简介

  System类是一些与系统相关的属性和方法的集合,而且所有属性都是静态的。

序号方法定义类型描述
1public static void exit(int static)普通系统退出,如果status为非0就表示退出
2public static void gc()普通运行垃圾回收机制,调用的是Runtime类的gc()方法
3public static long currentTimeMills()普通返回以毫秒为单位的当前时间
4public static Properties getProperties()普通取得当前系统的全部属性
5public 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 Environmentsun.boot.library.path=/Library/Java/JavaVirtualMachines/jdk...java.vm.version=25.101-b13gopherProxySet=falsejava.vm.vendor=Oracle Corporationjava.vendor.url=http://java.oracle.com/path.separator=:java.vm.name=Java HotSpot(TM) 64-Bit Server VMfile.encoding.pkg=sun.iouser.country=CNsun.java.launcher=SUN_STANDARDsun.os.patch.level=unknownjava.vm.specification.name=Java Virtual Machine Specificationuser.dir=/Users/mac/Documents/workspace/JAVA/Domojava.runtime.version=1.8.0_101-b13java.awt.graphicsenv=sun.awt.CGraphicsEnvironmentjava.endorsed.dirs=/Library/Java/JavaVirtualMachines/jdk...os.arch=x86_64java.io.tmpdir=/var/folders/t4/8fdnrsn903vbqf420xlgd...line.separator=java.vm.specification.vendor=Oracle Corporationos.name=Mac OS Xsun.jnu.encoding=UTF-8java.library.path=/Users/mac/Library/Java/Extensions:/L...java.specification.name=Java Platform API Specificationjava.class.version=52.0sun.management.compiler=HotSpot 64-Bit Tiered Compilersos.version=10.11.6user.home=/Users/macuser.timezone=java.awt.printerjob=sun.lwawt.macosx.CPrinterJobfile.encoding=EUC_CNjava.specification.version=1.8user.name=macjava.class.path=/Users/mac/Documents/workspace/JAVA/D...java.vm.specification.version=1.8sun.arch.data.model=64java.home=/Library/Java/JavaVirtualMachines/jdk...sun.java.command=Sep26.SystemDemo01java.specification.vendor=Oracle Corporationuser.language=zhawt.toolkit=sun.lwawt.macosx.LWCToolkitjava.vm.info=mixed modejava.version=1.8.0_101java.ext.dirs=/Users/mac/Library/Java/Extensions:/L...sun.boot.class.path=/Library/Java/JavaVirtualMachines/jdk...java.vendor=Oracle Corporationfile.separator=/java.vendor.url.bug=http://bugreport.sun.com/bugreport/sun.cpu.endian=littlesun.io.unicode.encoding=UnicodeBigsun.cpu.isalist=

  

 

Java入门——System类