Saturday, September 24, 2011

Quiz of the day | OCPJP (19)

Given:

3. public class O {
4. private int a = 2;
5. protected int s = 3;
6. private static int d = 4;
7. protected static int f = 5;
8. public static void main(String[] args) {
9. int a = 6; int s = 7;
10. int d = 8; int f = 9;
11. new O().new P().p();
12. }
13. class P {
14. void p() { System.out.println(a + " " + s + " " + d + " " + f); }
15. } }

What is the result?

A. 2 3 4 5
B. 2 7 4 9
C. 6 3 8 4
D. 6 7 8 9
E. Compilation fails due to multiple errors.
F. Compilation fails due only to an error on line 11.
G. Compilation fails due only to an error on line 14.


DOWNLOAD the answer

0 comments: