Introduction to Exceptions in Java

An exception is a divergence from an application’s normal behavior. Read about exception hierarchy in Java, checked and unchecked exceptions, and how to handle exceptions in Java.

Writing Custom Exceptions in Java

Custom Exceptions are user defined Exception classes that extend either Exception class or RuntimeException class.

Best Practices for Using and Writing Exceptions in Java

This article lays down some of the best practices which you can use during your design or code reviews, and assumes that you are familiar with the basics of exceptions in Java. Exceptions should be only used for exceptional conditions. It should not be used for control flow using techniques that might look very clever, like catching an exception and ending a loop.   

[Example-Lab] Hands On Exercise and Quiz on Exceptions

Let us do a simple hands on excercise followed by some questions to understand exceptions better. For theory and concetps of exceptions in Java. you can refer to the note introduction-to-exceptions-in-java



Create a class MyClass and create three methods myMethod1(), Method2() and Method3().


Invoke Method2() from Method1() and Method3() from Method2().

Search the Web

Custom Search

Searches whole web. Use the search in the right sidebar to search only within javajee.com!!!