How are arrays implemented in java?

前端 未结 4 1437
一向
一向 2020-12-03 05:14

Arrays are implemented as objects in java right? If so, where could I look at the source code for the array class. I am wondering if the length variable in arrays is defined

4条回答
  •  不思量自难忘°
    2020-12-03 05:39

    We can say that An array is a container that holds a fixed length of data of single data type. eg.

    int[] MyArray = new int[101]; // allocates memory for 101 integers, Range from 0 to 100.
    

    and for multidimensional

    String[][] names = {{"FirstName", "LastName"},{"Kaji", "Islam"},...};
    

    and for character array

    char[] ch={'a','b'....};
    

提交回复
热议问题