Iterando una matriz usando 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++;
         }
    }
}
Outrageous Ostrich