Java Array

refer to https://www.javatpoint.com/array-in-java

Nomally, array is a collection of similar type of elements that hava a contiguous memory location.

Java array is a object which contains elements of similar data type. It is a data structure where we store similar elements.  we can store fixed set of elements in Java array.

Array in java is index-based, the first element of the array is stored at the 0 index.

Advantages

  Code optimization : it makes the code optimized, we can retrive or sort data efficiently.

  Random acces : we can get all data located at an index position.

Disadvantages

  Size limit : we can only store a fixed size of elements in the array. It doesn't grow it's size at runtime. To solve this problem, collection of framework is used in java which grows automatically.

Type of array in java

原文地址:https://www.cnblogs.com/chenqr/p/10406143.html