1 Packageday13;2 3 Importjava.util.Arrays;4 Importjava.util.Properties;5 6 Public classDemo1 {7 8 /*9 The system class, which is used to obtain the system's attribute dataTen One common methods of the system class: A arraycopy (object src, int srcpos, object dest, int destpos, int length) copies an array to another - Parameters: - src-source array. the Srcpos-The starting position in the source array. - dest-target array. - Destpos-The starting position in the target data. - Length-The number of array elements to copy. + - Currenttimemillis () returns the current system time from 1970 to now how many milliseconds------the most frequently used method + A Exit (int status) quit JVM if 0 is normal exit Java Virtual machine Nonzero indicates exception exits Java Virtual Machine--------------General at 0 or non-zero out of the JVM, for Microsoft is intentional, it is possible to count the stability of the platform. - use 1 in Catch, if it's outside, use 0. - - GC () recommended that JVM virtual machines use the garbage collector as soon as possible garbage collection is seldom used - - in */ - to + - the //system.getproperties (); * /* $ Panax Notoginseng -- Listing properties-- - Java.runtime.name=java (TM) SE Runtime Environment the sun.boot.library.path=c:\users\administrator\appdata\local\ ... + java.vm.version=24.45-b08 A java.vm.vendor=oracle Corporation the 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.script= - USER.COUNTRY=CN - Sun.java.launcher=sun_standard the sun.os.patch.level=service Pack 1 - Java.vm.specification.name=java Virtual Machine SpecificationWuyi User.dir=g:\newworkspace\chuangzhiboke the Java.runtime.version=1.7.0_45-b18 - java.awt.graphicsenv=sun.awt.win32graphicsenvironment Wu java.endorsed.dirs=c:\users\administrator\appdata\local\ ... - Os.arch=amd64 About java.io.tmpdir=c:\users\admini~1\appdata\local\temp $ line.separator= - - java.vm.specification.vendor=oracle Corporation - user.variant= A os.name=windows 7 + SUN.JNU.ENCODING=GBK the java.library.path=c:\users\administrator\appdata\local\ ... - Java.specification.name=java Platform API specification $ java.class.version=51.0 the sun.management.compiler=hotspot 64-bit Tiered Compilers the os.version=6.1 the User.home=c:\users\administrator the user.timezone= - Java.awt.printerjob=sun.awt.windows.wprinterjob in File.encoding=utf-8 the java.specification.version=1.7 the User.name=administrator About Java.class.path=g:\newworkspace\chuangzhiboke\bin the java.vm.specification.version=1.7 the sun.arch.data.model=64 the java.home=c:\users\administrator\appdata\local\ ... + Sun.java.command=day13.demo1 - java.specification.vendor=oracle Corporation the User.language=zhBayi Awt.toolkit=sun.awt.windows.wtoolkit the java.vm.info=mixed Mode the java.version=1.7.0_45 - java.ext.dirs=c:\users\administrator\appdata\local\ ... - sun.boot.class.path=c:\users\administrator\appdata\local\ ... the java.vendor=oracle Corporation the file.separator= the java.vendor.url.bug=http://bugreport.sun.com/bugreport/ the Sun.cpu.endian=little - Sun.io.unicode.encoding=unicodelittle the sun.desktop=windows the Sun.cpu.isalist=amd64 the 94 */ the Public Static voidMain (string[] args) { the //TODO auto-generated Method Stub the /*98 int [] Srcarr = {212,2,32,60,545,11,15}; About int [] Desarr = new int [4]; - system.arraycopy (Srcarr, 1, Desarr, 1, 2);101 System.out.println (arrays.tostring (Desarr));102 */103 104 /* the System.out.println (System.currenttimemillis ());106 107 system.exit (0);108 System.out.println ("Because the Java Virtual machine has exited, so this line no longer played");109 the 111 for (int i = 0; i < 3; i++) { the New Person (i, "Ah Dog");113 System.GC (); the } the */ theProperties Pro =system.getproperties ();117 pro.list (System.out);118 /*119 System.out.println (System.getproperty ("java.version")); - System.out.println (System.getproperty ("Os.name"));121 */122 123 }124 the }126 127 classperson{ - Private intID;129 PrivateString name; the 131 PublicPerson (intID, String name) { the This. ID =ID;133 This. Name =name;134 }135 136 //overriding the garbage collection period of the object class137 @Override138 protected voidFinalize ()throwsThrowable {139 Super. Finalize (); $System.out.println ( This. Name + "was recycled!");141 }142 143}
System and Runtime classes