Category Java

Multiple Catch Block in Java

Multiple catch block in Java

In Java, a single try block can have multiple catch blocks. When statements in a single try block generate multiple exceptions, we require multiple catch blocks to handle different types of exceptions. This mechanism is called multi-catch block in Java.…

Java Try Catch Block (with Examples)

Exception Handling Mechanism using Java Try Catch block

In this tutorial, we will understand try-catch block in Java with the help of example programs. In the previous tutorial, we have known that when an error occurs within a method of program, the method creates an exception object and hand…

Checked and Unchecked Exceptions in Java

Checked and unchecked exceptions in Java

In this tutorial, we will learn checked and unchecked exceptions in Java with the help of example programs. We know that there are two types of exceptions in Java: first is predefined exceptions, and second user-defined exceptions. The predefined exceptions are…

Exception Hierarchy in Java

Exception hierarchy in Java

In this tutorial, we will learn exception hierarchy in Java with the help of diagram and brief descriptions. Basically, there are two types of exceptions in Java API. They are: Predefined Exceptions (Built-in-Exceptions) Custom Exceptions Let’s understand both predefined and…