Why the protected modifier behave differently here in Java subclass?
问题 I have the following two class in two different packages. my access modifier for instance method is protected which means any subclass in same or different package has access to it right?. however, in Eclipse I see the following message on my subclass Cat on line 17 The method testInstanceMethod() from the type Animal is not visible My code for super and subclass are below. package inheritance; public class Animal { public static void testClassMethod() { System.out.println("The class" + "