File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -301,9 +301,9 @@ public class Animal {
301301}
302302{% endhighlight %}
303303
304- A. ` abc ` < br >
305- B. Empty string< br >
306- C. Won't compile< br >
304+ A. ` abc `
305+ B. Empty string
306+ C. Won't compile
307307D. Runtime error
308308
309309__ Q2.__ What is the result?
@@ -327,10 +327,10 @@ public class Bottom2 extends Top {
327327}
328328{% endhighlight %}
329329
330- A. BD< br >
331- B. DB< br >
332- C. BDC< br >
333- D. DBC< br >
330+ A. BD
331+ B. DB
332+ C. BDC
333+ D. DBC
334334E. Compilation fails
335335
336336__ Q3.__ What is the result?
@@ -363,9 +363,53 @@ public class SubSubAlpha extends Alpha {
363363}
364364{% endhighlight %}
365365
366- A. subsub<br >
367- B. sub subsub<br >
368- C. alpha subsub<br >
369- D. alpha sub subsub<br >
370- E. Compilation fails<br >
371- F. An exception is thrown at runtime
366+ A. subsub
367+ B. sub subsub
368+ C. alpha subsub
369+ D. alpha sub subsub
370+ E. Compilation fails
371+ F. An exception is thrown at runtime
372+
373+ __ Q4.__
374+
375+ {% highlight java linenos %}
376+
377+ class Building {
378+ Building() {
379+ System.out.print("b ");
380+ }
381+
382+ Building(String name) {
383+
384+ this();
385+ System.out.print("bn " + name);
386+ }
387+ }
388+
389+ public class House extends Building {
390+ House() {
391+ System.out.print("h ");
392+ }
393+
394+ House(String name) {
395+ this();
396+ System.out.print("hn " + name);
397+
398+ }
399+
400+ public static void main(String[] args) {
401+ new House("x ");
402+ }
403+ }
404+ {% endhighlight %}
405+
406+ What is the result?
407+
408+ A. h hn x
409+ B. hn x h
410+ C. b h hn x
411+ D. b hn x h
412+ E. bn x h hn x
413+ F. b bn x h hn x
414+ G. bn x b h hn x
415+ H. Compilation fails
You can’t perform that action at this time.
0 commit comments