Hi,
This question is from Complete
Java 2 Certification Study Guide 5th Edition :
True or false: If class Y extends class X, the two classes are in different packages, and class X has a protected method called abby(), then any instance of Y may call the abby() method of any other instance of Y.
A. True
B. False
I chose true but the book states the correct answer as B.
Here's the explanation given by the author :
"An object that inherits a protected method from a superclass in a different package may call that method on itself but not on other instances of the same class."
I think the author is partially correct. The below code shows the opposite and compile and runs fine.
I think the author is partially correct or I'm missing something really important.
Any comments would be highly appreciated.