posted 18 years ago
Here we have got 2 cases -> Lets address one by one
Case (1) x.m();
This line absolutely ruled out. The code tries to access a private method outside its class. Strict NO!! NO!! to this.
Case (2) y.m();
Objects are created only during runtime. And Java compiler does n't know what Object the reference (Here "y") is referring to.
Hence, according to Java compiler, the code "y.m()" states that "y" is just the reference to the class "A"..hence the error (As per Case(1)'s rule)
Happy Learning!
Bala<br />SCJP 1.4 98%<br />SCBCD 1.3 -- 88%