Throwable #
" The Throwable class is the superclass of all errors and exceptions in the Java language. Only objects that are instances of this class (or one of its subclasses) are thrown by the Java Virtual Machine or can be thrown by the Java throw statement. Similarly, only this class or one of its subclasses can be the argument type in a catch clause. For the purposes of compile-time checking of exceptions, Throwable and any subclass of Throwable that is not also a subclass of either RuntimeException or Error are regarded as checked exceptions. “
μ€μ§ Throwable, Throwable μ νμ ν΄λμ€λ§ JVM, Java μ μν΄ λμ Έμ§ μ μμ (can be thrown)
μ€μ§ Throwable, Throwable μ νμ ν΄λμ€λ§ catch λ¬Έλ²μ μ¬μ©λ μ μμ
Error, RuntimeException μ μ μΈν Throwable μ νμν΄λμ€λ CheckedException
CheckedException : μ»΄νμΌ μμ μ Exception μ²΄νΉ λͺ©μ μΌλ‘ μ¬μ©λ¨
class μμ μ£Όμ (μ°Έκ³ : why is java.lang.Throwable a class?)
public class Throwable implements Serializable {
...
}
Error #
μμ€ν (μλ²) λ 벨, HW λ 벨μ μ€λ₯
μμ΅ν μ μλ μ¬κ°ν λ¬Έμ
- VirtualMachineError
- OutOfMemoryError
- InternalError
- StackOverflowError
- UnknownError
Exception #
CheckedException #
μμΈ μ²λ¦¬ νμ
μ»΄νμΌ μ 체ν¬
- IOException
- InterruptedException
- ClassNotFoundException
- NoSuchMethodException
- NoSuchFieldException
RuntimeException (UncheckedException) #
- NullPointerException
- ArithmeticException
- IllegalArgumentException
- NumberFormatException