wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Nested Loop Control Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Nested Loop Control" Watch "Nested Loop Control" New topic
Author

Nested Loop Control

Pete Tyo
Ranch Hand

Joined: May 11, 2005
Posts: 38
Jas Oberai
Ranch Hand

Joined: Jan 16, 2005
Posts: 231
Hi,
Try to print out as many values,so that you see wats taking place.I've reduced the limits of both the loops to 5,for readibility,just run this example and try to understand how the loop follow takes place:

Hope that helps..thanks!!!


SCJP 1.4 (88%)<br />SCWCD 1.4 (88%)
Pete Tyo
Ranch Hand

Joined: May 11, 2005
Posts: 38
Okay, those print statements sure help out alot. I understand it now. For each one time the outside loop runs the inner loop will run 5 times. So basiclly I can multiply the number of times the outerloop runs by the number of times the inner loop runs to figure out how many times the inner loop will run. If that makes sense.. Thankyou for your help.

Thanks,

Pete
 
wood burning stoves
 
subject: Nested Loop Control
 
Similar Threads
loops & labels
loop
Vector problems
Null Values?
Threads and ActionListeners