• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Returning to methods

 
Chris Sanker
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic