Results 1 to 3 of 3
  1. #1
    Freddie is offline Member
    Join Date
    May 2007
    Posts
    41
    Rep Power
    0

    Default Return to try block

    hello my friends, the doubt is how can I return to the try block after having treated the exception and correct the problem. For example:
    try

    {

    aPupil.delete(PosMani);

    }

    catch (Exception e)

    {

    cConsola.writeLine(e.getMessage());


    I want that my following code line allows me to back to try block, where I am doing the call of the method that through the exception
    and another thing, when I do like here in the example:


    CConsola.writeLine (e.getMessage ());


    There should not go out the message that and I have defined in the exception?

    Thank you for everything.
    Last edited by Freddie; 05-09-2007 at 06:30 PM.

  2. #2
    Alan is offline Member
    Join Date
    May 2007
    Posts
    39
    Rep Power
    0

    Default

    The answer is easy: you can not return to the try block after you do a catch
    yo can visit this url
    maybe you understand the concept
    http://www.exampledepot.com/egs/Java.../TryCatch.html

  3. #3
    fritz is offline Member
    Join Date
    May 2007
    Posts
    4
    Rep Power
    0

    Default

    the whole point of a try block is that if something goes wrong in that section, you need to abort and handle things. you don't WANT to continue with that code if an exception is thrown.

    If you want a line or block of code to run regardless of the exception, take it out of the try/catch/finally block.

    of course, you may need to put it into its OWN try/catch, if you do not declare you will throw the exeption...

Similar Threads

  1. Modify/create AVI's INFO BLOCK
    By Agus211 in forum New To Java
    Replies: 0
    Last Post: 02-11-2008, 04:20 PM
  2. need block letters??
    By dc2acgsr99 in forum New To Java
    Replies: 16
    Last Post: 01-29-2008, 09:31 AM
  3. Programming block
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-25-2007, 12:20 PM
  4. try...catch block
    By javaplus in forum New To Java
    Replies: 3
    Last Post: 11-06-2007, 08:53 PM
  5. Return in the Middle of synchronized Block
    By ariak in forum Advanced Java
    Replies: 1
    Last Post: 07-26-2007, 11:24 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
  •