I see that one definition can be this:
Generally RuntimeExceptions are exceptions that can be prevented
programmatically.
But that is still not the definition of a checked exception. I thought checked exceptions were "exceptions that can be handled at compile-time". Is that correct and/or can you tell me more?
I also read this on the site, can you explain the quote?
Many people say that checked exceptions (i.e. these that you should
explicitly catch or rethrow) should not be used at all.
Can I just learn what the definition is? I also read somewhat unexpectedly:
NumberFormatException is unchecked`
But I would think that NumberFormatException is checked since I would handle that at compile-time. Can you please help me understand? I've done some Java programming but I never wrote my own exception class, why would I need that?
Update
A definition is given is the SCJP book by Sierra / Bates:
解决方案
A checked exception is defined as any subclass of java.lang.Throwable (including Throwable itself) which is not a subclass of java.lang.Error or java.lang.RuntimeException. The guidelines you saw are just that, guidelines, designed to help you understand the intent of runtime exceptions.
See the Java Language Specification, section 11.1.1
The unchecked exception classes are the runtime exception classes and the error
classes.
The checked exception classes are all exception classes other than the unchecked
exception classes. That is, the checked exception classes are all subclasses of
Throwable other than RuntimeException and its subclasses and Error and its
subclasses.