Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

Iterating an Array Using While Loop

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
         int i=0;
         while(i<5){
              System.out.println(arr[i]);
              i++;
         }
    }
}
Source by softhunt.net #
 
PREVIOUS NEXT
Tagged: #Iterating #Array #Using #While #Loop
ADD COMMENT
Topic
Name
8+3 =