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 Returning to methods 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 "Returning to methods" Watch "Returning to methods" New topic
Author

Returning to methods

Chris Sanker
Greenhorn

Joined: Jan 27, 2003
Posts: 5
When one calls up a method inside of another method, is it possible to return to the end point in the first method after they finish the second method?
In simpler terms: I go from the middle of M1 to M2. I finish M2. How do I go back to where I left off from in M1?
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Assuming that the second method did not terminate the JVM (or that the JVM was not otherwise terminated), then control automatically returns to the first method that invoked the second method.
For example, the following code would produce the output
method1 begun
method2 invoked
method1 ended
were method1 properly invoked.


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
 
wood burning stoves
 
subject: Returning to methods
 
Similar Threads
Check second method invoked before first finished
assignment
overriding ??
what does it stand for >>>>reference variable.reference variable
what really it mean's