Java-system class

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.