Arrays in Java, Strings in Java, Array Declaration and Initialization in Java , Types of Strings in Java


Arrays in Java, Strings in Java, Array Declaration and Initialization in Java, Types of Strings in Java
                        An Array is used to store the multiple values of same type in a single variable. Arrays in Java are static type means the size of an array should be given in declaration time. Once the size of an array is defined then it is fixed and cannot be changed further.

Arrays Declaration, Construction & Initialization


Array Declaration

        int myArray[];
        int[] myArray;
        double[][] doubleArray; 


Array Construction

            int[] myArray = new int[5];
            int[][] twoDimArray = new int[5][4]


Array Initialization

  int[] myArray = new int[5];

  for (int I = 0; I < 5; i++) 
   {
     myArray[i] = i++;
   }
   
   int[5] myArray = {1,2,3,4,5};




{ 0 comments... read them below or add one }

Post a Comment