Java syntax: Difference between revisions

Content deleted Content added
Variables: Add subsection and main article
Enhanced for loop: Add main article
Line 621:
 
====Enhanced <code>for</code> loop====
{{Main|Enhanced for loop}}
 
[[enhanced for loop|Enhanced <code>for</code> loop]]s have been available since [[J2SE 5.0]]. This type of loop uses built-in iterators over arrays and collections to return each item in the given collection. Every element is returned and reachable in the context of the code block. When the block is executed, the next item is returned until there are no items remaining. Unlike [[C Sharp (programming language)|C#]], this kind of loop does not involve a special keyword, but instead uses a different notation style.