1.System类

  java_15 System类-LMLPHP

2.System类方法

  (1)currentTimeMillis()
  java_15 System类-LMLPHP

    public static void main(String[] args) {
long start = System.currentTimeMillis();
for (int i = 0; i < 10000; i++) {
System.out.println(i);
}
long end = System.currentTimeMillis();
System.out.println("------------");
System.out.println(end - start);
}

java_15 System类-LMLPHP
    (2)arraycopy(Object src, int srcPos, Object dest, int destPos, int length):   复制数组到目标数组

java_15 System类-LMLPHP

    public static void main(String[] args) {
int[] arr = {23,56,12,65,98}; //定义arr数组
int[] resu = new int[3]; //定义长度为3的resu数组
Arrays.sort(arr); //将arr数组从小到大排序
System.arraycopy(arr, 0, resu, 0, 3);//将arr数组中前3 个,即最小的3位数赋值给resu数组
for (int i = 0; i < resu.length; i++) { //打印
System.out.print(resu[i]+"\t");
}
}

java_15 System类-LMLPHP

  (2)exit ();

java_15 System类-LMLPHP
  (3)gc()

java_15 System类-LMLPHP
  (4)getProperties()

java_15 System类-LMLPHP

04-29 22:51