File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Cattle Drive and the fly likes Loops Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » This Site » Cattle Drive
Bookmark "Loops" Watch "Loops" New topic


Nath Maniedeo

Joined: Feb 15, 2008
Posts: 29
hi - I'm new. our teacher wrote: "While this kind of for loop does work, it is not as readable as a more traditional loop.
If I use a for loop, I like to see all three sections used."

so, what's a more traditional loop - the while loop? (I thought this was not ideal)

what are the 3 sections of the for loop?
Katrina Owen

Joined: Nov 03, 2006
Posts: 1367
Hi there,

The traditional for loop takes 3 sections:

loop test
a counting expression (often an incrementor)

this usually looks like this:
Nath Maniedeo

Joined: Feb 15, 2008
Posts: 29
thank you!
I agree. Here's the link:
subject: Loops
It's not a secret anymore!