Sunday 22 February 2015

How does exception handling work in Java?

Exceptions are of two types:

Compiler-enforced exceptions, or checked exceptions.
Compiler-enforced (checked) exceptions are instances of the Exception class or one of its subclasses — excluding the RuntimeException branch.
The compiler expects all checked exceptions to be appropriately handled.

Runtime exceptions, or unchecked exceptions.

Exception means When a method encounters an abnormal condition (an exception condition) that it can’t handle itself, it may throw an exception.

Error mens system doesn’t handle.For example:Overflow,Out of memory.


No comments:

Post a Comment