Junior — Middle
Can you list the main classes that extend Throwable in Java?
sobes.tech AI
Answer from AI
In Java, the class Throwable is the superclass for all errors and exceptions. The main classes extending Throwable are:
Error— errors that are usually not handled by the application (e.g.,OutOfMemoryError,StackOverflowError).Exception— exceptions that can and should be handled.
Subclasses of Exception are divided into:
-
Checked exceptions, for example:
IOExceptionSQLExceptionClassNotFoundException
-
Unchecked exceptions, which inherit from
RuntimeException, for example:NullPointerExceptionIllegalArgumentExceptionIndexOutOfBoundsException
Thus, the main classes extending Throwable are:
Throwable
├── Error
└── Exception
├── RuntimeException
└── (checked exceptions)
In Android, as in standard Java, the same exception classes are used.