File tree Expand file tree Collapse file tree 1 file changed +38
-1
lines changed
Expand file tree Collapse file tree 1 file changed +38
-1
lines changed Original file line number Diff line number Diff line change @@ -331,4 +331,41 @@ A. BD<br>
331331B. DB<br >
332332C. BDC<br >
333333D. DBC<br >
334- E. Compilation fails
334+ E. Compilation fails
335+
336+ __ Q3.__ What is the result?
337+
338+ {% highlight java linenos %}
339+ class Alpha {
340+ static String s = " ";
341+
342+ protected Alpha() {
343+ s += "alpha ";
344+ }
345+ }
346+
347+ class SubAlpha extends Alpha {
348+ private SubAlpha() {
349+ s += "sub ";
350+ }
351+ }
352+
353+ public class SubSubAlpha extends Alpha {
354+
355+ private SubSubAlpha() {
356+ s += "subsub ";
357+ }
358+
359+ public static void main(String[] args) {
360+ new SubSubAlpha();
361+ System.out.println(s);
362+ }
363+ }
364+ {% endhighlight %}
365+
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
You can’t perform that action at this time.
0 commit comments