The table below provides a list of frequently encountered Error and Exception types in Java:
|
Error/Exception |
Description |
|
ArithmeticError |
Occurs when a numeric calculation fails |
|
ArrayIndexOutOfBoundsException |
Java Errors and Exceptions represent abnormal conditions or unexpected events that disrupt the normal flow of a program’s execution. |
|
ClassFormatError |
Occurs when a class file is not accessible |
|
ClassNotFoundException |
Occurs when attempting to access a non-existent class |
|
ConcurrentModificationException |
Occurs when an element is added to or removed from a collection while iterating through it |
|
FileNotFoundException |
Occurs when a file is inaccessible |
|
IncompatibleClassChangeError |
Occurs when a base class is modified after a child class has been initialized |
|
InputMismatchException |
Occurs when invalid input is provided (e.g., entering text in a numerical field) |
|
InterruptedException |
Occurs when a Thread is interrupted during a wait or sleep operation |
|
InvalidClassException |
Occurs when the Serialization runtime detects an issue with a class |
|
IOException |
Occurs when an input or output operation encounters an error |
|
NegativeArraySizeException |
Occurs when attempting to create an array with a negative size |
|
NoClassDefFoundError |
Occurs when the class is not found during runtime |
|
NoSuchFieldException |
Occurs when attempting to access a class field or variable that does not exist |
|
NoSuchMethodException |
Occurs when attempting to access a class method that is not defined |
|
NullPointerException |
Occurs when attempting to access a null object reference |
|
NumberFormatException |
Occurs when a specified string cannot be converted to a numeric type |
|
RuntimeException |
Occurs when an exception happens during runtime |
|
StringIndexOutOfBoundsException |
Occurs when attempting to access a character in a String that is out of bounds |
|
TypeNotPresentException |
Occurs when a type cannot be located |
|
IllegalArgumentException |
Occurs when an invalid argument is passed to a method |
|
IllegalStateException |
Occurs when a method is called at an inappropriate time |