Sunday, February 11, 2007

How can I throw an exception without declaring it in a 'throws' clause?

Sometimes it is useful to throw exceptions, without explicitly declaring them in the throws clause of a method's signature. Any exceptions that extends java.lang.RuntimeException don't need to be declared. This means that it is safe to throw subclasses (like NullPointException), or to create your own.

SOURCE : www.referjava.com

No comments: