ErrorHandling.pptx
ErrorHandling.pptx
Exceptions:
These indicate conditions that a program might try
to catch and handle. They represent problems that
can occur during the execution of the program, often
due to issues within the code itself or external
factors. Exceptions are categorized into checked and
unchecked.
Exceptions:
Checked exceptions:
try {
// Code that might throw an exception
}
Error/Exception Description
ArithmeticError Occurs when a numeric calculation goes wrong
ArrayIndexOutOfBoundsException Occurs when trying to access an index number that does not exist in an array
ClassFormatError Occurs when a class file cannot be accessed
ClassNotFoundException Occurs when trying to access a class that does not exist
ConcurrentModificationException Occurs when an element is added or removed from iterables
Error/Exception Description
InterruptedException Occurs when a Thread is interrupted while waiting/sleeping
InvalidClassException Occurs when the Serialization runtime observes a problem with a class
IOException Occurs when an input or output operation fails
NegativeArraySizeException Occurs when trying to create an array with negative size
NoClassDefFoundError Occurs when the class is not found at runtime
NoSuchFieldException Occurs when trying to access a class field/variable that does not exist
NoSuchMethodException Occurs when trying to access a class method that does not exist
Error/Exception Description
InvalidClassException Occurs when the Serialization runtime observes a problem with a class
IOException Occurs when an input or output operation fails
NegativeArraySizeException Occurs when trying to create an array with negative size
NoClassDefFoundError Occurs when the class is not found at runtime
NoSuchFieldException Occurs when trying to access a class field/variable that does not exist
NoSuchMethodException Occurs when trying to access a class method that does not exist
NullPointerException Occurs when trying to access an object referece that is null
NumberFormatException Occurs when it is not possible to convert a specified string to a numeric type
Error Handling
Here is the list of Error and Exception types in
Java:
Error/Exception Description
RuntimeException Occurs when an exception occurs at runtime
StringIndexOutOfBoundsException Occurs when trying to access a character in a String that does not exist
TypeNotPresentException Occurs when a type cannot be found
IllegalArgumentException Occurs when when an illegal argument is passed to a method
IllegalStateException Occurs when when a method is called at an illegal time
RuntimeException Occurs when an exception occurs at runtime
StringIndexOutOfBoundsException Occurs when trying to access a character in a String that does not exist