java tutorial - Java Improved for loop - java programming - learn java- java basics - java for beginners
Learn Java - Java tutorial - Java improved for loop - Java examples - Javaprograms
Improved loop for is mainly used to bypass the collection of elements, including arrays. Has been introduced since Java 5.
Syntax
The syntax of the improved for loop:
- Announcement : Access to the newly declared variable block is made, which is of type compatible with the elements of the array.
- Expression : calculates the one you need in the array of the loop. The expression can be a variable or an array method, whose call is returned by the array.