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 »