System系統類,主要用于獲取系統的屬性數據和其他操作,構造方法是私有的。

public class Demo01 {
public static void main(String[] args) {
//方法1.arraycopy:數組的復制

    //1.src:源數組
    //2.srcPos:從哪個位置開始復制
    //3.dest:目標數組
    //4.destPos:目標數組的位置
    //5.length:復制的長度

    int[] arr={10,20,30,32,42,52,65,78}; //源數組
    int[] dest=new int [8];   //新的數組
    System.arraycopy(arr,0,dest,0,arr.length);
    for (int i = 0; i < arr.length ; i++) {
        System.out.println(dest[i]);
    }
     //方法2.獲取毫秒數
    //獲取從1970年到現在的毫秒數
    System.out.println(System.currentTimeMillis());
    //此方法可以用來獲取計算時間,例:
    long start=System.currentTimeMillis();
    for (int i = -999999999; i <999999999; i++) {
        for (int j =-999999999; j <999999999; j++) {
            long result=i+j;

        }
        }
    long end=System.currentTimeMillis();
    System.out.println("計算用時:"+(end-start));



    new Student("aaa",19);
    new Student("bbb",19);
   new Student("ccc",19);
   new Student("ddd",19);
   new Student("eee",19);
     //方法3.回收垃圾
       System.gc();  //告訴垃圾回收器回收垃圾



    //方法4.退出jvm
    //0為正常退出jvm,非0表示異常退出jvm
    System.exit(0);
    System.out.println("程序結束了");


    }



}