Tag Archives: Exception

Exception Handling Tips

Please refer to Basic Exception Handling before reading some exception questions below. Question 1.  Consider the following program: Which one of the following options correctly describes the behavior of this program? a) The program prints the following: InvalidKeyException. b) The program prints the following: RuntimeException. c) The program prints the following: IllegalArgumentException. d) The program prints… Read More »

Basic Exception Handling

This note will cover as following below: Overview. Handle or declare exception. Create your own exception. Checked v.s Unchecked Exception. Throw vs Throws. Common mistakes. Advantage of exception. 1. Overview Figure 1: The Throwable class (source: The Java Tutorials of Oracle). As can be seen from the Figure 1, an exception object is an instance… Read More »