Array is the collection of elements which can be values or variables.
Example :
Array can be initialize after its declaration by its index :
Declaration of Array in Java
dataTypeof Array[] arrayName = new dataTypeof Array[Max Size of Array];
Example :
int[] myArray = new int[3];
Initialization of Array in Java
Array can be initialize at same time when it is declare.Here is code :
int [] myArray = {1,2,3,4};
Array can be initialize after its declaration by its index :
myArray[0]=1; myArray[1]=2; myArray[2]=3; myArray[3]=4;
0 comments:
Post a Comment