NOT. foreach not a keyword in Java.
The foreach is a simple syntax to iterate through arrays or collections - an implementation of the java.lang.Iterable interface.
In Java, the for keyword and operator : are used to create a foreach .
// Java example String[] oddBalls = {"one", "three", "five", "seven"}; for (String currentBall : oddBalls) { System.out.println (currentBall + " is an odd number."); }
The main for loop has been extended in Java 5 to make iterating through arrays and other collections more convenient. This new for statement is called enhanced for or foreach .
Frankline
source share