Skip to content

Commit 19c0a14

Browse files
author
Ram swaroop
committed
added content
1 parent aa981a7 commit 19c0a14

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

_posts/2015-08-20-nested-classes.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,3 +424,32 @@ class Inner {
424424
}
425425
}
426426
{% endhighlight %}
427+
428+
{% include responsive_ad.html %}
429+
430+
### Q&A
431+
432+
__Q1.__
433+
434+
{% highlight java linenos %}
435+
public class HorseTest {
436+
public static void main(String[] args) {
437+
class Horse {
438+
public String name;
439+
public Horse(String s) {
440+
name = s;
441+
}
442+
}
443+
Object obj = new Horse("Zippo");
444+
System.out.println(obj.name);
445+
}
446+
}
447+
{% endhighlight %}
448+
449+
What is the result?
450+
451+
A. An exception occurs at runtime at line 10
452+
B. Zippo
453+
C. Compilation fails because of an error on line 3
454+
D. Compilation fails because of an error on line 9
455+
E. Compilation fails because of an error on line 10

0 commit comments

Comments
 (0)