Package Com.day10.System class;
public class Demosystem {
/**
* @param args
* Common Objects (Overview of the System class and methods used)
* Overview of the A:system class
* The System class contains some useful class fields and methods. It cannot be instantiated.
* B: Member method
* public static void GC () runs garbage collection mechanism
* public static void exit (int status)//terminate the current Java running virtual machine
* public static long Currenttimemillis ()//difference between current time and 1970 year time
* Pubiic static void Arraycopy (object src, int srcpos, object dest, int destpos, int length)
* Copy the original array into the current array
* C: Case Demo
* Member methods of the system class are used
*/
public static void Main (string[] args) {
for (int i=0;i<10;i++)
{
New Demo ();
System.GC ();//Run the garbage collector, the equivalent of shouting cleaning aunt
}
/*system.exit (0);//Non 0 State is abnormally terminated, exit JVM
System.out.println ("1111111");//not executed because the Java virtual machine has exited
*/
Long Start=system.currenttimemillis ();
for (int i=0;i<1000;i++)
{
System.out.println ("*");
}
Long End=system.currenttimemillis ();//
System.out.println (End-start);
Long A=system.currenttimemillis ();
System.out.println (a);
Int[] src={11,22,33,44,55};
Int[] Dest=new int[8];
System.arraycopy (src,0,dest,0,src.length);
for (int i = 0; i < dest.length; i++) {
System.out.print (dest[i]+ "");//11 22 33 44 55 0 0 0
}
}
}
Class demo{
@Override
public void Finalize () {
System.out.print ("Rubbish is swept up");
}
}
Java-system class