This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Enhanced for loop - new to Java 5 or Java 6? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Enhanced for loop - new to Java 5 or Java 6?" Watch "Enhanced for loop - new to Java 5 or Java 6?" New topic
Author

Enhanced for loop - new to Java 5 or Java 6?

Dave McQueen
Greenhorn

Joined: May 22, 2009
Posts: 29
Hi,
I'm rereading parts of the SCJP study guide for Java 6 book by Bert Bates and Kathy Sierra but am confused about something:- the book says that 'As of Java 6, the for loop took on a second structure'. Wasn't the enhanced for loop new to Java 5 and not 6? I'm reading all over the web that this is the case, so is this just a typo (page 345 beginning of paragraph Using For Loops)?
As usual, your help is appreciated,
Dave


Before you criticize someone, try walking a mile in their shoes. That way you'll be a mile away from them. And you'll also have their shoes.
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

You are correct. The enhanced for loop was introduced in Java 5.


"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9291
    
  17

This mistake has been reported before and soon there will be an errata for this and other such errors...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Harikrishna Gorrepati
Ranch Hand

Joined: Sep 23, 2010
Posts: 422
From Java 5, We have Enhanced For Loop


OCPJP 6.0-81% | Preparing for OCWCD
http://www.certpal.com/blogs/cert-articles | http://sites.google.com/site/mostlyjava/scwcd |
 
 
subject: Enhanced for loop - new to Java 5 or Java 6?
 
Similar Threads
Is there anything developed in java 4 and not run in java 5?
a new way to do the for loop
Enhanced For Loop
Discussing errata for K&B, SCJP 6
Enhanced for loops