Considering the following program, which of the options are true?
public class Main{ public static void main (String args []){ try{ /*from w w w.j a v a2 s . co m*/ if (args.length == 0) return; else throw new Exception ("Some Exception"); } catch (Exception e){ System.out.println ("Exception in Main"); } finally{ System.out.println ("The end"); } } }
Select 2 options
Correct Options are : A C
Even if the program is executed without any arguments, the 'args' is NOT NULL.
In such case it will be initialized to an array of Strings containing zero elements.
The finally block is always executed, no matter how control leaves the try block.
Only if, in a try or catch block, System.exit()
is called then finally will not be executed.