ARRAY IN JAVA

Hello friends!!
my new post is on Array in Java program .
Introductions :
Array is a one type collection of similar data type. Array is a group of contiguous and related data items that share a common name. An array stores multiple data and same data type in a contiguous of a memories.Array store only fixed set of a elements in a array of Java. Array of any type can be created and may also have one or more dimensions. A specific elements in array is accessed by its Index . Array created a first Index store in 0. 

 There are two type:-

(1)one- dimensional array .
 
(2)multi -dimensional array.
 
(1) one- dimensional array :
 A one -dimensional array is a list of like - type variable. To create a array, first must create an array variable of the desired type. 
The substance for declaration:
        
 type var -name [];
 
The base data type is the Type of an array.
 
INSTANTIATING ARRAY : Instantiating array during the new operator with the syntax:
    Array-var=new type [array size].'

The statement does two things: It create to array data type [array-size ]; create to variable array name.
Example of one dimensional array


(2)MULTI- DIMENSIONAL ARRAY
Multidimensional array are actually array of arrays. To declare a multidimensional are variable, additional, index useing to another set of square brackets.
synstax :
       data type []array name;
       data type []array name ; 

Example to Instantiate : multidimensional array in Java. 

             int[]array=new int[2] [3];
                                            ^   ^
                                        row   column

PASSING ARRAY TO METHODS :
 
This method use to passing a method to value and array to method.
Returning an array from a method: 
A method is show to return an array and that is copy to another array. 

ARRAY METHODS :
(1) Arrays.binary search
(2) Arrays.equal
(3) Arrays.fill
(4) Arrays.sort

Thank you

For being updated with the news related to the technology follow us here:
facebook: CLICK HERE!!!!!!!!!!
Twitter: @NewAgeInformers
Instagram: @new_age_informers_


Comments