Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

2
  • 2
    You have to be a Cat to use testInstanceMethod(). Casting to Animal restricts access to that method to the package lavel and since your main is in different package the code fails. (I think it would not even compile). Yes the method is there but you don't have permission to access it as it is declared in Animal by protected. Commented Apr 4, 2014 at 17:32
  • The second statement should have been formulated as: "To satisfy protected level access, one of two conditions must be met..." (See also the comment I made below that answer.) Commented Nov 13, 2015 at 13:14