Array

 Array in Java

  • It is a collection of data of same data type.
  • It is used to store group of data simultaneously.
  • It can store data of same data type means an integer array can store only integer value ,character array can store only character value and so on.
  • We can not fetch data from array directly therefore we use index point.
  • The indexing of array always start with 0.
  • Index value is always an integer number.
  • Array may be of any data type like int,char,float etc.



  • Here a is the name of array.
  • int is the data type of array.
  • Size of array is 5 means we can store maximum 5 values in this array.
 int ar[]={45,23,89,12,78};
 

int a[]=new int[5];
  a[0]=45;
  a[1]=23;
  a[2]=89;
  a[3]=12;
  a[4]=78


Types of Array 
 
 One Dimensional
 Multi Dimensional 
 
    


int a[3][3]={ {40,50,60},{10,20,30},{70,80,90} };

Post a Comment

0 Comments