1.

Predict the output:public class Test{public static void main(String args[]){try{String arr[] = new String[10];arr = null;arr[0] = "one";System.out.print(arr[0]);}catch(Exception ex){System.out.print("exception");}catch(NullPointerException nex){System.out.print("null pointer exception");}}}

A. one" is printed.
B. exception" is printed.
C. null pointer exception" is printed.
D. ompilation fails saying NullPointerException has already been caught.
E. one of these
Answer» E. one of these


Discussion

No Comment Found

Related MCQs