Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
@nuzyly Yes, you are completely correct.
ArithmeticException
is a subclass ofRuntimeException
.RuntimeException
andError
are called unchecked in Java terminology, because they do not need to be declared in athrows
clause of a method. That's because they are meant to represent programming problems, that client code cannot expect to recover from (see the documentation and this short article for the details).So my question is: Why should one declare such an exception? You wouldn't generally declare
NullPointerException
s, would you? I think it would be more appropriate, to document this kind of exception in a doc comment:/** @throws ArithmeticException if the result overflows a long */
The intention is better readable that way, but a comment would suit it better, I'd say.
What do you mean?
Why declare an unchecked exception?