Results 1 to 2 of 2
  1. #1
    fallout87 is offline Member
    Join Date
    Mar 2012
    Posts
    2
    Rep Power
    0

    Default return; statement

    So this is how my code goes:

    main()
    call menu()

    menu()
    if answer = .....
    1stMethod()
    if answer = .....
    2ndMethod()

    1stMethod()
    //statements
    return; //want to return to the main so it can call menu() again but it just quits the program

    2ndMethod()
    //statements
    return; //want to return to the main so it can call menu() again but it just quits the program

  2. #2
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,585
    Rep Power
    12

    Default Re: return; statement

    It would help if you posted real code and described its output, as well as the output you want. It need not (and probably should not) be your real code - what would help would be a cut down version that just illustrates the logic.

    Oracle's Tutorial section on Control Flow Statements may help. But without seeing code, that's just a guess. Also note that, unlike the flow constructs described there, "return" takes you from one method to another, different, one.

Similar Threads

  1. Missing return statement
    By Aenohe in forum New To Java
    Replies: 8
    Last Post: 03-07-2012, 02:03 PM
  2. If Statement return
    By ricardo5222 in forum New To Java
    Replies: 4
    Last Post: 11-01-2010, 12:43 PM
  3. Help with Recursion and return statement
    By nicolek808 in forum New To Java
    Replies: 3
    Last Post: 09-10-2009, 11:02 AM
  4. there is no return statement
    By gabriel in forum New To Java
    Replies: 17
    Last Post: 12-03-2008, 05:55 PM
  5. [SOLVED] return statement
    By Nakira in forum New To Java
    Replies: 8
    Last Post: 11-13-2008, 12:00 AM

Posting Permissions

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