Skip to content
This repository was archived by the owner on Feb 10, 2024. It is now read-only.

Commit 18e7beb

Browse files
author
Ram swaroop
committed
added questions
1 parent 8f6487b commit 18e7beb

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

_posts/2015-05-14-variables-and-literals.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,3 +501,40 @@ B. Line B
501501
C. Line C
502502
D. Line D
503503
E. Line E
504+
505+
__Q2.__
506+
507+
{% highlight java linenos %}
508+
class Mixer {
509+
Mixer() {
510+
}
511+
512+
Mixer(Mixer m) {
513+
m1 = m;
514+
}
515+
516+
Mixer m1;
517+
518+
public static void main(String[] args) {
519+
Mixer m2 = new Mixer();
520+
Mixer m3 = new Mixer(m2);
521+
m3.go();
522+
Mixer m4 = m3.m1;
523+
m4.go();
524+
Mixer m5 = m2.m1;
525+
m5.go();
526+
}
527+
528+
void go() {
529+
System.out.print("hi ");
530+
}
531+
}
532+
{% endhighlight %}
533+
534+
What is the result?
535+
A. hi
536+
B. hi hi
537+
C. hi hi hi
538+
D. Compilation fails
539+
E. hi, followed by an exception
540+
F. hi hi, followed by an exception

0 commit comments

Comments
 (0)