Exception Handling in Java: Hierarchy Example and Types

One of the important topic Exception handling in java Here we will discuss basics of exceptions, Why Exception handling and its types. What is Exception in Java A unwanted event that disrupts the program execution. In Java all Exceptions are class. Why Exception Occurs Due to wrong user input Incorrect programming logic Example of Exceptions … Read more

Exception Handling in Java with Examples

To learn about exception handling first you must know what is an exception What is an Exception in Java An exception is run time error that can occur due to wrong user input or due to logical error in programming. Arithmetic Exception Example Consider a simple example. Take two integer number from command prompt and … Read more

Exception Handling try catch finally blocks in Java

What is try block A try block is used to surround a set of statements where exceptions may occur. A try block used with catch and finally block Also Read Exception Handling in Java: Hierarchy Example and Types What is a catch block A catch block is created followed by a try block. Whenever an … Read more

Throw and Throws Keywords in Java

In java programming, If the exception occurs within the try block it is thrown. Throw and Throws Keywords in Java is very important to throw exceptions. a throw keyword is used to throw an exception A system-generated exception is automatically thrown by the java run time system but if we want to manually throw an … Read more

Finally Keyword in Java

In java exception handling, any code that we want to must be execute put inside the finally block. After the execution of try and catch block, finally block executes. try block must be used with either catch or finally, or with both. Normally when exception occurs then further programs never executes.  But either exception occurs … Read more