Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

For loop Java Example to Iterate an Array

class Main {
    public static void main(String args[]){
         int arr[]={1,2,3,4,5};
         //i starts with 0 as array index starts with 0 too
         for(int i=0; i<arr.length; i++){
              System.out.println(arr[i]);
         }
    }
}
Source by softhunt.net #
 
PREVIOUS NEXT
Tagged: #For #loop #Java #Example #Iterate #Array
ADD COMMENT
Topic
Name
4+3 =