Compile Time Errors
Logical Errors
Runtime Errors
These errors in Java programming language are called exceptions.
The class Exception refers to an exceptional event in Java.
It is an event that occurs during the execution of a program that disrupts the normal flow of instructions which could lead to unintended outcomes, generate error messages, or even an application crash.
The Exception class is a subclass of Throwable class and java.lang.Object as root of the class hierarchy. Only objects of Throwable class can be thrown and caught.
When an error occurs, an object called Exception Object is created and passed to the runtime system which contains information about the error.
Creating and passing of the Exception Object is called throwing an exception.
Once the exception is thrown, the runtime system then tries to look for an appropriate handler for this event. The handler chosen is said to catch the exception.
There are three kinds of exceptions in Java:
Checked exceptions are exceptional conditions that an application should anticipate and recover from, like reading a non-existing file, this should be handled and notify the user.
Error exceptions are exceptional conditions that are external to the application and the application cannot anticipate or recover from such as a hardware malfunction.
Runtime exceptions are exceptional conditions that are internal to the application and application cannot anticipate or recover from; an example is a logic error like passing null as an argument to method call that expects a non-null object.