+ 7

Extends Exception or RuntimeException

I am reading a code written by someone and some of its exceptions extends RuntimeException and others Exception. But I can't understand why. Is there a valid explanation (advantages or disadvantages) to choose one or the other?

30th Nov 2018, 2:51 PM
Al Toe
1 Answer
+ 1
The advantage about creating custom exception like that is we can provide more useful information in the exception, but still The best practice is use the provided execption if no advantages provided.
30th Nov 2018, 3:59 PM
Taste
Taste - avatar