posted 16 years ago
Hi Preetha
The line 06 (print(f)) won't give a compilation error. that is because, the data membre, f, is declared as protected in Father class. So it will become as a private mamber in the subclass, Son. The member method, sayitOut() can directly access that one. so it wont give any error.
About line08(print(F.f)), the method is trying to access the protected data member of class Father, from a separate class, Son. This will results the compilation error.
Hope this will clear for you.
Thanks<br /> <br />Anoobkumar<br />SCJP 1.5