---
title: "Exceptions : What is difference between checked and unchecked exceptions"  
description: "Exceptions : What is difference between checked and unchecked exceptions"  
author: "Anonymous User"  
published: 2015-07-24  
updated: 2020-09-22  
canonical: https://www.mindstick.com/interview/2727/exceptions-what-is-difference-between-checked-and-unchecked-exceptions  
category: "java"  
tags: ["exception handling", "java"]  
reading_time: 2 minutes  

---

# Exceptions : What is difference between checked and unchecked exceptions

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. eg, 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, however, the compiler doesn't force client programmers either to catch the exception or declare it in a throws clause. In fact, client programmers may not even know that the exception could be thrown. eg, StringIndexOutOfBoundsException thrown by String's charAt() method Checked exceptions must be caught at compile time. Runtime exceptions do not need to be. Errors often cannot be.

## Answers

### Answer by Anonymous User

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. eg, 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, however, the compiler doesn't force client programmers either to catch the exception or declare it in a throws clause. In fact, client programmers may not even know that the exception could be thrown. eg, StringIndexOutOfBoundsException thrown by String's charAt() method Checked exceptions must be caught at compile time. Runtime exceptions do not need to be. Errors often cannot be.


---

Original Source: https://www.mindstick.com/interview/2727/exceptions-what-is-difference-between-checked-and-unchecked-exceptions

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
