I took a sample test from the OCA study guide. This question was presented below. Can someone explain the answer to me? The answer is C, E and F. I don't understand why answer E is correct. The explanation is that "Line 9 does not compile because the variable reference is to a Frog". I still don't understand this because ribbit is protected. How is it that referencing Tadpole as a Frog on line 8 causes this compile issue? When I code this and put the 2 classes in the same package, every line compiles, including line 10. I'm stumped. Was wondering if someone else could elaborate on this? It seems to me that even through the Tadpole is referenced as a Frog, whether I'm referencing a Frog or a Tadpole, it feels like I should have access to a protected method at that point. Why not?
Which lines in Tadpole give a compiler error? (Choose all that apply)
The Frog class is in a different package and the Tadpole class is referencing it. This is a problem. If a Tadpole object was calling the code it would work through inheritance. But here, the Frog call might as well be an unrelated class in a different package.