In the Jeanne Boyarsky & Scott Selikoff's book OCA Study guide for Java SE 8 in Chapter 4 is the following code -
This code doesn't compile because we are not in the Goose class. The floatInWater() method is declared in Bird. GooseWatcher is not in the same package as Bird, nor does it extend Bird. If I put the GooseWatcher class in the same package as Bird the code works but even if I extend GooseWatcher as subclass of Bird (in a different package) the last line doesn't compile! ... Can someone please explain why. Thanks in advance.
Note:- pond.goose.Goose is a subclass of pond.shore.Bird class. While the GooseWatcher class is in pond.duck package.