Home › Programing Inrerview Questions on try catch Programing Inrerview Questions on try catch Posted by: InstanceOfJava Posted date: Jan 12, 2015 / comment : 0 1. what is the output of following program: package com.instanceofjavaforus; public class Demo{ public static void main(String[] args) { try{ System.out.println("instance of java"); } } } Click for Output Compilte time error 2. what is the output of following program: package com.instanceofjavaforus; public class Demo{ public static void main(String[] args) { try{ System.out.println("try block"); } finally{ System.out.println("finally block"); } } } Click for Output try block finally block 3. what is the output of following program: package com.instanceofjavaforus; public class StringDemo{ public static void main(String[] args) { try { int a = 0; int b = 10; int c = b / a; System.out.print("try block"); } catch(Exception e) { System.out.print("catch block"); } } } Click for Output catch block Share !
No comments