Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Cattle Drive and the fly likes FOR    LOOP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » This Site » Cattle Drive
Bookmark "FOR    LOOP" Watch "FOR    LOOP" New topic


amir zaheer

Joined: Aug 14, 2001
Posts: 2
i m new to java and trying to lern the basics. i have understood
what FOR LOOP is but i cant understand the logic to put while mking a programme
i have tried to understand from different books how the FOR LOOP
works but cant mke programme as i desire
can any one send me detailed and simple notes to understand FOR LOOP operation
Greg Harris
Ranch Hand

Joined: Apr 12, 2001
Posts: 1012

compile and run this... it counts from 1 to 10 because of the for loop.
"i is set to "1"
for( int i = 1 ;
and is incremented by 1 each "loop"
i++ );
until it is "<= 10"
i <= 10 ;
then the loop terminates.

[This message has been edited by Greg Harris (edited August 14, 2001).]

Johannes de Jong

Joined: Jan 27, 2001
Posts: 5089
Hi amir I'm moving this topic to "Java in General (Beginner)" forum.
Good luck learning java
good catch though Greg
Marilyn de Queiroz

Joined: Jul 22, 2000
Posts: 9056
Did you see the link on the assignment page about for loops?

"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
I agree. Here's the link:
subject: FOR LOOP
It's not a secret anymore!