Multiple choice technology programming languages

Given: class Mixer { Mixer() { } Mixer(Mixer m) { ml = m;} Mixer m1; public static void main(String[] args) { Mixer m2 = new Mixer(); Mixer m3 = new Mixer(m2); m3.go(); Mixer m4 = m3.m1; m4.go(); Mixer m5 = m2.m1; m5.go(); } void go() { System.out.print("hi "); } } What is the result?

  1. hi

  2. hi hi

  3. hi hi hi

  4. Compilation fails

  5. hi, followed by an exception

  6. hi hi, followed by an exception

Reveal answer Fill a bubble to check yourself
F Correct answer
Explanation

m3.go() prints 'hi'. Then m4=m3.m1 is null since m1 was never initialized. Calling m4.go() throws a NullPointerException. The output is 'hi' followed by the exception.