What will be the output of the following program?
public class Main{ public static void main (String [] args) throws Exception{ try{// ww w. j a va2s .c om m (); System.out.println ("try"); } catch (Exception e){ System.out.println ("catch"); } finally { System.out.println ("finally"); } System.out.println ("out"); } public static void m (){ } }
Select 1 option
Correct Option is : B
Since the method m () does not throw any exception, try is printed and the control goes to finally which prints finally.
After that out is printed.