Java - system class

First, the basic rules:

 Systems, mainly for one attribute data acquisition system, there is no construction method can not be instantiated, all methods are static;

Second, the method:

( . 1 ) static the Properties getProperties (); return current system properties;

  // Properties is a HashMap subclass that is, Map a subclass;

public class Test {
    public static void main(String[] args) {
        Properties properties = System.getProperties();
        for (Object ele : properties.keySet()) {
            System.out.println(ele + (String) properties.get(ele));
        }
    }
}

( 2 ) static String getProperty (String Key); attribute acquisition system indicated by the specified key.

( . 3 ) static String the setProperty (String Key, String value); setting system property indicated by the specified key;

4)复制数组:static void arraycopy(Object src, int srcPos, Object dest, int destPos, int length);

    . 1 ) the src : the source array;

    2 ) srcPos : the source array from the starting position;

    3 ) dest : destination array;

    . 4 ) length : length copy;

public class Test {
    public static void main(String[] args) {
        int[] arr = {1,2,3,4,5,6};
        int[] temp = new int[4];
        System.arraycopy(arr, 1,temp,0,3);
        System.out.println(Arrays.toString(temp));
        //[2, 3, 4, 0]
    }
}

( 5 ) Long currentTimeMillis () ; Gets the number of milliseconds from now past Greenwich Mean Time ;

( 6 ) void Exit (int Status) ; Terminates the currently running Java Virtual Machine; status: 0 representative immediately closed jvm;

( . 7 ) void GC (); running the garbage collector;

 

Guess you like

Origin www.cnblogs.com/Tractors/p/11247655.html