make use foreach loop in java

By Super Man

here i will show how to use foreach loop in java.



int i[] = {1,2,3,4,5}

// now, if we want to iterate through each item of array i, then we can use foreach loop like this


for( int temp_var : i )
{


System.out.println ( temp_var)
}


o/p:

1
2
3
4
5

make use foreach loop in java  (1094 Views)