Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-09-2007, 04:17 PM
Member
 
Join Date: May 2007
Posts: 42
Freddie is on a distinguished road
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.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 05-09-2007, 06:33 PM
Member
 
Join Date: May 2007
Posts: 39
Alan is on a distinguished road
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
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 05-11-2007, 09:58 PM
Member
 
Join Date: May 2007
Posts: 5
fritz is on a distinguished road
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...
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Modify/create AVI's INFO BLOCK Agus211 New To Java 0 02-11-2008 04:20 PM
need block letters?? dc2acgsr99 New To Java 16 01-29-2008 09:31 AM
Programming block Java Tip Java Tips 0 12-25-2007 12:20 PM
try...catch block javaplus New To Java 3 11-06-2007 08:53 PM
Return in the Middle of synchronized Block ariak Advanced Java 1 07-26-2007 11:24 AM


All times are GMT +3. The time now is 10:30 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org