Multiple Choice Question

Quiz Guidelines

 

QID: 
546
Question: 

What will the following code print when run?

public class Test {
    static String s = "";
    public static void m0(int a, int b) {
        s += a;
        m2();
        m1(b);
    }
    public static void m1(int i) {
        s += i;
    }
    public static void m2() {
        throw new NullPointerException("aa");
    }
    public static void m() {
        m0(1, 2);
        m1(3);
    }
    public static void main(String args[]) {
        try {
            m();
        } catch (Exception e) {
        }
        System.out.println(s);
    }
}

Select 1 option

A. 1
B. 12
C. 123
D. 2 
E. It will throw exception at runtime.

Q&A Set: