PDA

Click to See Complete Forum and Search --> : How do you exit sub in Java


xxarmoxx
Jun 6th, 2007, 01:03 PM
In vb you can say

if filename = "" then exit sub

and that will stop the function from executing more code, how can I do the same in java?

Here is what I got so far but its not compiling

private void jToggleButton1ActionPerformed(java.awt.event.ActionEvent evt) {



String filename=jTextArea1.getText();

if filename = "" then return;


}


What do i have to put instead of 'return'?

ComputerJy
Jun 6th, 2007, 01:09 PM
The return keyword will do exactly the same as Exit Sub in VB

ComputerJy
Jun 6th, 2007, 01:12 PM
And by the way:
if filename = "" then return;
Oh my god
It's:if( filename.equals("") ) return;

xxarmoxx
Jun 6th, 2007, 01:46 PM
lol, I accidentally put 'then' , java doesn't use then. Its gonna be hard getting used to Java again. Thanx brotha

eranga262154
Jun 10th, 2007, 10:20 PM
Never mind. Correct it right now. It is good to see pal.