In this tutorial, we will learn to use throw and throws keyword for exception handling with the help of examples. In Java, exceptions can be categorized into two types: Unchecked Exceptions: They are not checked at compile-time but at run-time.For example: ArithmeticException, NullPointerException, ArrayIndexOutOfBoundsException, exceptions under Error class, etc. Checked Exceptions: They are checked at compile-time. For example, IOException, InterruptedException, etc. Refer to Java Exceptions to… Continue reading Throw and throws
Category: 7. Exception Handling
Try…catch
In this tutorial, we will learn about the try catch statement in Java with the help of examples. The try…catch block in Java is used to handle exceptions and prevents the abnormal termination of the program. Here’s the syntax of a try…catch block in Java. The try block includes the code that might generate an exception. The catch block includes the code that… Continue reading Try…catch
Java Exception Handling
In the tutorial, we will learn about different approaches of exception handling in Java with the help of examples. In the last tutorial, we learned about Java exceptions. We know that exceptions abnormally terminate the execution of a program. This is why it is important to handle exceptions. Here’s a list of different approaches to handle… Continue reading Java Exception Handling