Basically, array is a collection of similar type of elements that have contiguous memory location.
JAVA ARRAY is an object the contains elements of similar data type. It is a data structure where we store similar elements. We can store only fixed set of elements in a java array.
Array in java is index based, first element of the array is stored at 0 index.
Advantage of Java Array:
Code Optimization: It makes the code optimized, we can retrieve or sort the data easily.
Random access: We can get any data located at any index position.
Disadvantage of Java Array:
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.
Types of Array in Java
Single Dimensional Array
Single Dimensional Array in java
Syntax to Declare an Array in java
Instantiation of an Array in java
Example of single dimensional java array
we are going to declare, instantiate, initialize and traverse an array.