What is Array? code example

Example: What is Array?

An array is a container object that holds a fixed number 
of values of a single type. The length of an array is established 
when the array is created. After creation, its length is fixed. 
You have seen an example of arrays already, in the main 
method of the "Hello World!" application.
This section discusses arrays in greater detail.Each item in an array is called an element, 
and each element is accessed by its numerical index.Advantage of Java Array 
o Code Optimization: It makes the code optimized, 
we can retrieve or sort the data easily. 
o Random access: We can get any data located at any index position.Disadvantage of Java Array 
o 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.

Tags:

Java Example