[3149] in java-interest
Re: I want to shoot myself!!!!!!!!!!!!!!!!!!
daemon@ATHENA.MIT.EDU (Arthur van Hoff)
Wed Nov 1 18:58:11 1995
Date: Wed, 1 Nov 1995 12:06:15 -0800
From: Arthur.Vanhoff@Eng.Sun.COM (Arthur van Hoff)
To: jpayne@starwave.com
Cc: java-interest@java.Eng.Sun.COM
Hi Jon,
Cheer up!
> Would somebody please explain to me when I should make an exception be
> a RuntimeException rather than just an Exception? Right now I want to
> make everything a RuntimeException because my life is hell.
Go ahead. It is your own choice.
> So please explain to me again (I realize everybody else on the planet
> already understands this) when something should be a RuntimeException
> rather than just an Exception (that needs declaring). You must have
> had something in mind when you came up with this distinction.
RuntineExceptions should be used only for things that can happen anywhere
regardless of what method you are calling. An example is NullPointerException.
It would be silly if you had to declare it everywhere because it can happen
anywhere.
When you are writing a program that uses its own exceptions you have a
choice. You can avoid having to declare them by making them subclasses
of RuntimeException, or you can require declaration by making them normal
exceptions. It is really up to you. If you want other people to use your
code, and if you want exceptions to be part of the API, then you should
make them normal exception. If you a hacker and you don't care about
formal declartions, then you don't...
> Remember, you're talking to an idiot here, so make it simple and give
> lots of examples.
I know.
Have fun,
Arthur van Hoff
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com