Hi, I'm studying for Java Programmer Certification (SCJP) exam. A question about exceptions, when handle exceptions is it best to handle a specific exception like NumberFormatException
or catch all exceptions use the parent Exception
class
?
Base on my course unchecked exceptions are basically a RunTimeException
which mostly result of a program bug. Does this mean that when I throw an exception manually I should rather use:
new Exception("... my message...")
and that I shouldn't handle RunTimeException
?
Only handle checked exceptions?