Exceptions

Rules of Exceptions in Method Overriding

After knowing Rules of "Access Specifiers in Method Overriding", let us find the "Rules of Exceptions in Method Overriding". The rule says "Subclass overridden method cannot throw more checked exceptions than that of super class method". Let us explain the rule through a program for clear and easy understanding. The following program does not compile …

Rules of Exceptions in Method Overriding Read More »

Try with Finally Java (without Catch)

Generally, programmer writes try in combination with catch. Using finally block is optional. But it is possible to have try with finally without catch block) and compiler accepts clearly. Observe the following code. public class Demo { public static void main(String args[]) { try { System.out.println(10/0); } finally { System.out.println(); System.out.println(“From finally block”); } System.out.println(“Hello …

Try with Finally Java (without Catch) Read More »

IndexOutOfBoundsException

IndexOutOfBoundsException Summary: In this tutorial, you learn handling of IndexOutOfBoundsException with its subclasses. IndexOutOfBoundsException is an unchecked exception that extends RuntimeException. This is used by the JVM to check the index number entered by the user is within the range of an array or string. Full hierarchy of exceptions is available at "Hierarchy of Exceptions …

IndexOutOfBoundsException Read More »

Hierarchy Exceptions Checked Unchecked Exceptions

Hierarchy of Exceptions (Checked Unchecked Exceptions) After knowing exceptions and exception handling mechanism, let us explore how many exceptions exist, are they inheriting from a common super class, any classification exists or not etc. Whenever you come across a new Java class, it is essential to know its super classes, so that, you can use …

Hierarchy Exceptions Checked Unchecked Exceptions Read More »

Exceptions Meaning Tutorial

Exception handling makes a language robust. This Exceptions Tutorial for Beginners explains concepts in Simple terms Examples Screenshots. Go on reading. The programmer faces two types of problems in coding – problems arising at compile-time and problems arising at runtime. Regarding compile-time problems or mistakes the compiler takes care of and ultimately does not compile …

Exceptions Meaning Tutorial Read More »