The System class in Java

Source: Internet
Author: User

A, Arraycopy method

public static void Arraycopy (object src, int srcpos, object dest, int destpos, int length)

The function of this method is to copy the array.

B, Currenttimemillis method

public static long Currenttimemillis ()

The function of this method is to return the current computer time, the time expression format is the current computer time and GMT time (GMT) January 1, 1970 0:0 0 seconds the number of milliseconds.

C, Exit method

public static void exit (int status)

The function of this method is to exit the program. Where status has a value of 0 for normal exit, not 0 for abnormal exit. By using this method, the program Exit function can be realized in the programming of graphical interface.

D, GC method

public static void GC ()

The function of this method is to request the system for garbage collection. Whether the system is recovered immediately depends on the implementation of the garbage collection algorithm in the system and the implementation of the system.

E, GetProperty method
public static string GetProperty (String key)
The function of this method is to obtain the value corresponding to the attribute named key in the system.

Common examples:

String osname = System.getproperty ("Os.name");

SYSTEM.OUT.PRINTLN ("Current operating system is:" + osname);

String user = System.getproperty ("User.Name");

System.out.println ("Current user is:" + user);

String separator = system.getproperty ("File.separator");

System.out.println ("Delimiter for file path string:" + separator);

Many system-level parameters and corresponding values can be obtained by using this method.

The System class in Java

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.