jQuery in Action, 3rd edition
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Questions about Exceptions Handling Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Questions about Exceptions Handling" Watch "Questions about Exceptions Handling" New topic

Questions about Exceptions Handling

Mike Tilling
Ranch Hand

Joined: Feb 17, 2006
Posts: 86

1- Can I throw the same custom exception (say ServerInternalException) when RemoteException or InterruptedException are thrown ?

2- How do I recover the RemoteException (Do I stop both Client and Server applications)?

3- same question for IOException
4- Same question for the InterruptedException?

5-When creating custom excptions, is it better to subclass from the RuntimeException class or the Exception class

Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11776

Hi Mike,

Before answering any of these questions, I think you need to ask yourself:
  • When will these exceptions be thrown?

  • Who will be throwing them?

  • What do I want to have happen in response to those events?
  • Once you have some answers to those questions, you may find that the questions you asked may be redundant, or may need to be reworded.

    I know I haven't really answered your question, but it is deliberate - you will be a better programmer if you can sit down and work through this yourself.

    Please do your thinking out loud (that is - as you think about the questions I have raised, feel free to put your thoughts in this post).

    Regards, Andrew

    The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
    I agree. Here's the link: http://aspose.com/file-tools
    subject: Questions about Exceptions Handling
    It's not a secret anymore!