Array in Java
Array in Java
Array is a collection of similar type of elements that have contiguous memory location.Java array is an object the contains elements of same datatype. it is a data structure where we store similar elements. We can
store only fixed set of elements in a java array.
Arrays in Java are homogeneous data structures implemented in Java as objects
Advantage of Java Array :
1) Code Optimization : It makes the code optimized, we can retrieve or sort the data easily.
2) Random access : We can get any data located at any index position
Disadvantage of Java Array :
1) Size Limit : We can store only fixed size of elements in the array. It doesn't grow its size at runtime. To solve this problem, collection framework is used in java.
There are two types of array.
- Single Dimensional Array
- Multidimensional Array
Comments
Post a Comment