November 2017

Create a Custom Exception in Java

  • Satish 

1. Introduction In this tutorial, we’ll cover how to create a custom exception in Java. We’ll show how user-defined exceptions are implemented and used for both checked and unchecked exceptions. 2. The Need for Custom Exceptions Java exceptions cover almost all general exceptions that are bound to happen in programming. However, we sometimes need to supplement these standard exceptions with our own. The main reasons for introducing custom exceptions are: Business logic exceptions – Exceptions that are specific to the business… Read More »Create a Custom Exception in Java

Exception Handling in Java

  • Satish 

1. Overview In this tutorial, we’ll go through the basics of exception handling in Java as well as some of its gotchas. 2. First Principles 2.1. What Is It? To better understand exceptions and exception handling, let’s make a real-life comparison. Imagine that we order a product online, but while en-route, there’s a failure in delivery. A good company can handle this problem and gracefully re-route our package so that it still arrives on time. Likewise, in Java, the code can… Read More »Exception Handling in Java