Arrays

Arrays

Previous Home Next

 

Arrays is a collection of same type of elements.An array store multiple items of same data type.in a contiguous block of memory divided into slots.to declare an array write a data type followed by [] followed by the identifier name.  arrays may be one dimensional ,two dimensional and multidimensional arrays.

java.util is a class of java . lang .object package which contains various methods used for manipulating arrays.this
class also contains static factory that allows arrays to be viewed as list.
 java.util class contains various methods used for manipulating arrays.the method in this class also throw NullPointerException if the  specified array reference is null

int [] salary
salary=new int [1000000]

OR

int [] age= new int [1000000]

this is how array are declare by two ways

 
public class Sample
{
 public static void main( String[] args )
{

int[] ages = new int[100];
for
( int i=0; i<100; i++ )
{
 System.out.print( ages[i] );
 }
 }
 }


Previous Home Next