Exception Chaining in Java

Exception chaining in java allows us to relate one exception to another exception. An application often responds to an exception by throwing another exception. In effect, the first exception causes

Read More →

User Defined Exceptions in Java

While working on an application, you may come across some scenarios where you feel like the Exceptions defined in the java platform are not enough to represent the error/issue you want to tell the

Read More →

Rethrowing of Exception in Java

Rethrowing of exception in java has improved starting from Java 7. We can now specify more specific exceptions using throws keyword. Before java 7:

In the above met

Read More →

Catching Multiple Exceptions in Java

Catching multiple exceptions in java is now very easy starting from Java 7. Before java 7 we used to write the below code for catching multiple exceptions

But since

Read More →

Throws in exception handling in java

Throws keyword in java is used to declare exceptions that can be thrown by the method. Throws keyword can be used to throw multiple exception. syntax: 1. Throws single exception [crayon-62fec8673cf

Read More →

How to Throw exception in java

Exceptions in java can be thrown using the “throw” keyword. The throw statements requires a object to throw. This object needs to be a throwable object. Syntax: [crayon-62fec8673d336060

Read More →