---
title: "RuntimeException and Exception Behavior"  
description: "RuntimeException and Exception Behavior"  
author: "Revati S Misra"  
published: 2023-07-28  
updated: 2023-07-29  
canonical: https://www.mindstick.com/forum/159354/runtimeexception-and-exception-behavior  
category: "exception handling"  
tags: ["exception handling", "exception"]  
reading_time: 2 minutes  

---

# RuntimeException and Exception Behavior

[RuntimeException](https://www.mindstick.com/forum/159356/how-does-jvm-handle-runtimeexception-s) and [Exception](https://www.mindstick.com/articles/1824/objective-c-exception-handling) [Behavior](https://yourviews.mindstick.com/story/4857/acoustic-crypsis-behavior-in-animals)

## Replies

### Reply by Aryan Kumar

Runtime exceptions and exceptions behave differently in Java. Runtime exceptions are unchecked exceptions, which means that they are not checked at compile time. This means that a method does not have to handle or specify a runtime exception. If a runtime exception is thrown, the program will simply crash.

Exceptions, on the other hand, are checked exceptions. This means that a method must handle or specify an exception. If an exception is thrown and is not handled or specified, the compiler will not allow the code to compile.

Here is a table that summarizes the differences between runtime exceptions and exceptions in Java:

| Feature | Runtime Exceptions | Exceptions |
| --- | --- | --- |
| Checked | No | Yes |
| Handled at compile time | No | Yes |
| Examples | NullPointerException, ArrayIndexOutOfBoundsException, ArithmeticException | IOException, SQLException, ClassNotFoundException |
| Behavior | Program crashes if not handled | Program does not compile if not handled |

The behavior of runtime exceptions and exceptions is different because runtime exceptions are typically caused by programming errors, while exceptions can be caused by either programming errors or external factors. Runtime exceptions are therefore considered to be less important than exceptions, and so they are not checked at compile time.

Here are some additional details about the behavior of runtime exceptions and exceptions in Java:

- Runtime exceptions are typically caused by programming errors, such as trying to divide by zero or accessing a null reference.
- Exceptions can be caused by either programming errors or external factors, such as a network connection being lost.
- If a runtime exception is thrown, the program will simply crash. This is because runtime exceptions are typically caused by programming errors, and there is no way to recover from them.
- If an exception is thrown and is not handled or specified, the compiler will not allow the code to compile. This is because exceptions can be caused by either programming errors or external factors, and so it is important to handle them in order to prevent the program from crashing.


---

Original Source: https://www.mindstick.com/forum/159354/runtimeexception-and-exception-behavior

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
