I\'m reading Sybex Complete Java 2 Certification Study Guide April 2005 (ISBN0782144195). This book is for java developers who wants to pass java certification.
Because variable type is irrelevant here till it is 'sane' in context of question. As method abby()
belongs to X
(and Y
inherits it), it doesn't matter with what type variable referencing instance of Y is declared: it can be either X
or Y
. Be abby()
accessible, we could call it through both variables:
X myY1 = new Y();
myY1.abby();
Y myY2 = new Y();
myY2.abby();