Given: Throwable exception is a superclass.
When I read a book on my 'exception', see examples of blocks and other texts used in the throwable
hold Code> new exception () is being used in the cache
block I have not yet received an explanation when each should use.
My question is, when should throws
be used and when new exception (<)
can be used?
Edit: By using either hold
or else
:
is worth throwing;
or
throw a new exception (); (From comments) raised this issue that I need it
/ P>
In that case, you want to throw an check exception . You can create a custom subclass of it (except for and its subclasses which are unchecked ), or exception
(such as " CollectionBuildException
"). To get the speed with Java exceptions, see.
Comments
Post a Comment