Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

Accessing Java Array Elements using for Loop

class ArrayUsingLoop
{
    public static void main (String[] args)
    {        
      int[] newArray;
         
      newArray= new int[5];
         
      newArray[0] = 1;
      newArray[1] = 2;
      newArray[2] = 3;
      newArray[3] = 4;
      newArray[4] = 5;
         
      for (int i = 0; i < newArray.length; i++)
         System.out.println("Array Element at index " + i +
                                      " : "+ newArray[i]);         
    }
}
Source by softhunt.net #
 
PREVIOUS NEXT
Tagged: #Accessing #Java #Array #Elements #Loop
ADD COMMENT
Topic
Name
7+2 =