what are checked and unchecked exceptiona checked


What are Checked and UnChecked Exception?

A checked exception is some subclass of Exception (or Exception itself), excluding class RuntimeException and its subclasses. Making an exception checked forces client programmers to deal with the possibility that the exception will be thrown.

Example: IOException thrown by java.io.FileInputStream's read() method·

Unchecked exceptions are RuntimeException and any of its subclasses. Class Error and its subclasses also are unchecked. With an unchecked exception, though, the compiler doesn't force client programmers either to catch the exception or declare it in a throws clause. In fact, client programmers might not even know that the exception could be thrown.

Example: StringIndexOutOfBoundsException thrown by String's charAt() method· Checked exceptions must be caught at compile time. Runtime exceptions do not require to be. Errors often cannot be.

 

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: what are checked and unchecked exceptiona checked
Reference No:- TGS0310977

Expected delivery within 24 Hours