This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes doubt pg 340 of k&b Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "doubt pg 340 of k&b" Watch "doubt pg 340 of k&b" New topic

doubt pg 340 of k&b

harinath chakrapani
Ranch Hand

Joined: Jun 11, 2007
Posts: 40
the wordings are:
The enhanced for loop asumes that, barring an early exit from the loop, you'll always loop throught every element of the array. The following discussions of break and continue appy to both the basic and enhanced for loops.

i cant understand this.
any one please explain. thanks in advance

Harinath chakrapani
Manfred Klug
Ranch Hand

Joined: Jun 04, 2007
Posts: 377
Hi harinath,

the following enhanced for loop

is basically something like this:
Sridher Reddy

Joined: Mar 27, 2007
Posts: 8
to add to Manfred's explaination...
what the line also means is that, the "enhanced for loop" and the "basic for loop", both will continue to work the way mentioned above unless they encounter any of the
System.exit(0); or break; or continue; statements.

_ ______________________________ _ <br />I'm using jdk1.5.0_12
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: doubt pg 340 of k&b