- Unchecked Exceptions in Java – Complete List with Descriptions
- 1. Arithmetic and Number-Related Exceptions
- 2. 📦 Array and Collection-Related Exceptions
- 3. 🧵 Threading and Synchronization Exceptions
- 4. 🧑💻 Null and Type-Related Exceptions
- 5. 🛠️ Illegal Usage or Configuration Exceptions
- 6. 🎛️ Formatting and Input Exceptions
- 7. 🌍 Resource and Reflection-Related Exceptions
- 🔄 Summary Table by Category
- 📝 Bonus Tip: Custom Unchecked Exceptions
In Java, unchecked exceptions are the exceptions that occur during runtime and are not checked by the compiler. These exceptions are subclasses of RuntimeException, and the Java compiler doesn’t force you to catch or declare them using throws.
Unchecked exceptions typically occur due to programming errors like bad logic, null access, invalid type casting, or improper use of collections. While they can crash your application if not handled properly, understanding them helps you write more robust and bug-free code.
In this guide, we’ve organized all the major unchecked exceptions in Java into clear categories—so you can quickly learn, recognize, and handle them effectively.
Unchecked Exceptions in Java – Complete List with Descriptions
1. Arithmetic and Number-Related Exceptions
| Exception | Description |
|---|---|
ArithmeticException | Division by zero or other invalid arithmetic operation |
NumberFormatException | Parsing a string into a number with invalid format |
IllegalFormatException (and subtypes) | Format string issues during String.format() |
Examples:
int a = 10 / 0; // ArithmeticException
Integer.parseInt("abc"); // NumberFormatException
System.out.printf("%d", "hello"); // IllegalFormatConversionException
2. 📦 Array and Collection-Related Exceptions
| Exception | Description |
|---|---|
ArrayIndexOutOfBoundsException | Accessing an array with an invalid index |
NegativeArraySizeException | Creating an array with a negative size |
ArrayStoreException | Storing wrong type into an array |
IndexOutOfBoundsException | Superclass for array and list indexing issues |
ConcurrentModificationException | Modifying a collection while iterating |
NoSuchElementException | Calling next() when no element is present |
EmptyStackException | Accessing an empty stack |
Examples:
int[] a = new int[3];
a[5] = 10; // ArrayIndexOutOfBoundsException
ArrayList<String> list = new ArrayList<>();
list.get(1); // IndexOutOfBoundsException
3. 🧵 Threading and Synchronization Exceptions
| Exception | Description |
|---|---|
IllegalThreadStateException | Thread is not in the correct state |
IllegalMonitorStateException | Using wait/notify outside synchronized context |
Examples:
Thread t = new Thread();
t.start();
t.start(); // IllegalThreadStateException
4. 🧑💻 Null and Type-Related Exceptions
| Exception | Description |
|---|---|
NullPointerException | Accessing method or field on a null object |
ClassCastException | Invalid type casting |
EnumConstantNotPresentException | Enum constant not found |
TypeNotPresentException | Type info missing during reflection or generics |
Examples:
String s = null;
s.length(); // NullPointerException
Object obj = "test";
Integer i = (Integer) obj; // ClassCastException
5. 🛠️ Illegal Usage or Configuration Exceptions
| Exception | Description |
|---|---|
IllegalArgumentException | Method gets an inappropriate argument |
IllegalStateException | Object is not in correct state for requested operation |
UnsupportedOperationException | Method is not supported by object |
SecurityException | Security manager violation |
Examples:
Thread t = new Thread();
t.setPriority(11); // IllegalArgumentException
List<String> list = Collections.unmodifiableList(new ArrayList<>());
list.add("item"); // UnsupportedOperationException
6. 🎛️ Formatting and Input Exceptions
| Exception | Description |
|---|---|
InputMismatchException | Scanner gets input that doesn’t match expected type |
MissingFormatArgumentException | Format string argument is missing |
DuplicateFormatFlagsException | Duplicate format flags in string formatting |
MissingFormatWidthException | Format specifier width is missing |
FormatFlagsConversionMismatchException | Incompatible format flags |
7. 🌍 Resource and Reflection-Related Exceptions
| Exception | Description |
|---|---|
MissingResourceException | Resource bundle key or file not found |
UncheckedIOException | Wrapper for IOException as unchecked |
AnnotationTypeMismatchException | Annotation has incompatible value |
IllegalComponentStateException | GUI component not ready for interaction |
🔄 Summary Table by Category
| Category | Example Exceptions |
|---|---|
| Arithmetic / Numbers | ArithmeticException, NumberFormatException |
| Arrays / Collections | ArrayIndexOutOfBoundsException, ConcurrentModificationException |
| Threads / Sync | IllegalThreadStateException, IllegalMonitorStateException |
| Null & Type | NullPointerException, ClassCastException |
| Illegal State / Arguments | IllegalArgumentException, UnsupportedOperationException |
| Input / Formatting | InputMismatchException, IllegalFormatException |
| Resources / Reflection | MissingResourceException, UncheckedIOException |
📝 Bonus Tip: Custom Unchecked Exceptions
You can create your own unchecked exceptions like this:
class InvalidAgeException extends RuntimeException {
public InvalidAgeException(String msg) {
super(msg);
}
}