Results 1 to 5 of 5

Thread: How do you exit sub in Java

  1. #1

    Thread Starter
    Hyperactive Member xxarmoxx's Avatar
    Join Date
    Mar 2007
    Posts
    378

    How do you exit sub in Java

    In vb you can say
    Code:
    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

    Code:
        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'?

  2. #2
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: How do you exit sub in Java

    The return keyword will do exactly the same as Exit Sub in VB
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  3. #3
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: How do you exit sub in Java

    And by the way:
    vb Code:
    1. if filename = "" then return;
    Oh my god
    It's:
    Code:
    if( filename.equals("") ) return;
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  4. #4

    Thread Starter
    Hyperactive Member xxarmoxx's Avatar
    Join Date
    Mar 2007
    Posts
    378

    Re: How do you exit sub in Java

    lol, I accidentally put 'then' , java doesn't use then. Its gonna be hard getting used to Java again. Thanx brotha

  5. #5
    PowerPoster eranga262154's Avatar
    Join Date
    Jun 2006
    Posts
    2,201

    Re: How do you exit sub in Java

    Never mind. Correct it right now. It is good to see pal.
    “victory breeds hatred, the defeated live in pain; happily the peaceful live giving up victory and defeat” - Gautama Buddha

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width