Mohnish Khiani wrote:when p calls printit(),the object calling it is of class B.
Therefore it calls this.printit() where this is an object of class B.Hence it is like B.printit() and not A.printit() as there is no relationship between printit() of A and B.Please explain???
There is no relationship becuase both printit are different methods.
Printit in class A is private, so the printit in B is a new method, and it does not override printit from A.
Both printit has just the same names. If you would give them different names, you would get the same result.