package test1;
1. public class Test1 {
2. static int x = 23 ;
3. }
-----------------------------------------
1. package test2;
2. public class Test2 extends test1.Test1 {
3. public staic void main(String [] args) {
4. System.out.println("x = " + x);
5. }
6. }
what is the result?
A. x = 0
B. x = 23
C. compilations fail because of an error in line 2 of Test2.
D. compilations fail because of an error in line 3 of Test1.
E. compilations fail because of an error in line 4 of Test2.
my answer is C.
but my fren said that there is no wrong with line 2 of Test2 because Test2 can extends test1.Test1.
instead he said that D is the answer because the line 3 of Test1 is the default acess, so from package test2 cant' access package test1's class's variable of x =23.
so any advice from senior here??? please help me....thanks.