This week's giveaway is in the Spring forum.
We're giving away four copies of Learn Spring Security (video course) and have Eugen Paraschiv on-line!
See this thread for details.
Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

doubt pg 340 of k&b

 
harinath chakrapani
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

regards,
Harinath chakrapani
 
Manfred Klug
Ranch Hand
Posts: 377
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi harinath,

the following enhanced for loop

is basically something like this:
 
Sridher Reddy
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic