About Question enthuware.ocpjp.v7.2.1493 :
Posted: Sat Jul 27, 2013 12:49 pm
Really hard to understand this point!!!
Could you answer me why does
work/compile fine when I do "i" in A static ?
I think that static members are not inherited( or are they ?
), and protected members are accessible in Sub-classes only "through inheritance"... For example, inside B, I could code:
or even:
... but... then why I cant do
inside A ????

Could you answer me why does
Code: Select all
public void process(A a) { a.i = a.i*2; }
I think that static members are not inherited( or are they ?

Code: Select all
this.i
super.i
Code: Select all
new B().i // Accessible in B because protected is to class, but not for the object
Code: Select all
new B().i