Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Leaving a method

Status
Not open for further replies.

adrianjohnson

Programmer
Joined
May 16, 2002
Messages
145
Location
GB
I'm quite new to Java, and I have an easy problem (well, it must be ...). I have a method such as:

void heresmymethod
{
if (something happens)
do something
// leave the method
else
do something else

other stuff in the method
}

What is the code for the // leave the method line? I can't find examples anywhere (not looking in the right place?). I've tried exit and return.

The method which calls this one is the action performed on a button on an input screen (dialog), so I'd like the screen to go away, leaving the other screen (already open anyway) on the screen.

Hope this makes sense. If not, let me know and I'll try and explain things a bit better.

Adrian Johnson
Assystance - i.t. solutions
 
replace the "// leave the method" line with "return;" (no quotes).

--------------------------------------------------
Free Database Connection Pooling Software
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top