class Mixer {
Mixer() { }
Mixer(Mixer m) { m1 = m; }
Mixer m1;
public static void main(String[] args) {
Mixer m2 = new Mixer();
Mixer m3 = new Mixer(m2);
m3.go();
Mixer m4 = m3.m1; \\ line 1
m4.go();
Mixer m5 = m2.m1; \\ line 2
m5.go();
}
void go() { System.out.print("hi "); }
}
What is the result?
A. hi
B. hi hi
C. hi hi hi
D. Compilation fails
E. hi, followed by an exception
F. hi hi, followed by an exception
The answer given as F.
But can any1 explain what is happening at line 1 and line2. I mean what is the result if two objects are joined by a dot operator ?
and I am sorry but I got this question from a online book and I donno the name of this book.