java try finally

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.

In the above code, catch block is missing. But Hello1 is not printed as the ArithmeticException…

try catch finally Exception Handling Java

try catch finally – The finally Block We know earlier, there should be a successful handler in the catch block like ArithmeticException for division by zero and ArrayIndexOutOfBoundsException for wrong array index number etc. Placing a wrong handler is equivalent to not having a try-catch block at all. There may…