Sunday, October 2, 2011

Quiz of the day | OCPJP (27)

Given two files:

1. package x;
2. public class J {
3. int a = 1;
4. protected int b = 2;
5. public int c = 3;
6. }

3. package y;
4. import x.*;
5. public class H {
6. public static void main(String[] args) {
7. J j = new J();
8. System.out.print(" " + j.a);
9. System.out.print(" " + j.b);
10. System.out.print(" " + j.c);
11. }
12. }

http://www.blogger.com/img/blank.gif
What is the result? (Choose all that apply.)

A. 1 2 3
B. 1 followed by an exception
C. Compilation fails with an error on line 7
D. Compilation fails with an error on line 8
E. Compilation fails with an error on line 9
F. Compilation fails with an error on line 10


DOWNLOAD the answer

0 comments: