This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes to and fro out of a loop to a method in back? 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 "to and fro out of a loop to a method in back?" Watch "to and fro out of a loop to a method in back?" New topic

to and fro out of a loop to a method in back?


Joined: Feb 09, 2005
Posts: 21
is there a way to put a method call in a loop, so that once an array for this instance is incrimented, the program jumps to a method, finds a case in a flow control, jumps to another method completes a task and then jumps back to the loop itself? if so how would i do that or does jave do it itself do I need to include any return statements or anything i need to know before I try this action. and since this is a bit vague i will include some code

any help on this will be much appriciated.
Jeanne Boyarsky
internet detective

Joined: May 26, 2003
Posts: 30068

You are 99% there. You just need to call the method from the loop:

I didn't see the array update you mentioned (it may be there, I didn't read every line of code.) You could add this right before the call to command fetch.

Each time the loop executes, commandFetch() is called. That method calls the appropriate commandXXX() method. After the commandXXX() method is called, it returns to commandFetch(). As there is nothing left in commandFetch() to do, it returns control to the loop.

[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
subject: to and fro out of a loop to a method in back?
Similar Threads
NIO Selector - single threaded use
calling and no ringing apparently
Trials and tribulations, trys and catches
Oh, God I NEED Help!!!!!!!!
StringTokenizer Class