Sunday, September 25, 2011

Quiz of the day | OCPJP (20)

Given:

2. public class X {
3. private int g = 3;
4. public static void main(String[] args) {
5. new X().xii();
6. }
7. void xii() {
8. int x = 6;
9. Y y = new Y();
10. class Y {
11. void yii() { System.out.println(g + x); }
12. }
13. y.yii();
14. }
15. }

What is the result? (Choose all that apply.)

A. Compilation succeeds.
B. Compilation fails due to an error on line 3.
C. Compilation fails due to an error on line 8.
D. Compilation fails due to an error on line 9.
E. Compilation fails due to an error on line 10.
F. Compilation fails due to accessing x on line 11.
G. Compilation fails due to accessing y on line 11.


DOWNLOAD the answer

0 comments: