Use of the Array class

package com.day15.collection;

import java.lang.reflect.Array;
/*
* There is no constructor in the Array class, so it cannot be instantiated, Array a=new Array();
*/

public class Array_Test {

  public static void main(String[] args) {
    int[] arr= new int[]{0,1,2,3,4,5,6,7,8,9};
    int a=Array.getInt(arr , 1);//1, the getInt method is static, you can directly use the class to call
    System.out.println(a);
    System.out.println(Array.get(arr, 1));//1
  }

}

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325466591&siteId=291194637