Which methods can a subclass inherit in Java?

后端 未结 6 1451
说谎
说谎 2021-02-09 19:12

Sorry I am a newbie to Java. I am trying to get my head around inheritance and subclass/superclass relationships in Java.

If classA is a subclass of classB, will classA\

6条回答
  •  醉酒成梦
    2021-02-09 19:24

    ClassB's private methods are not visible to ClassA. If you want to give ClassA access to internal methods of ClassB (without those methods becoming part of ClassB's public interface) you should make them protected instead of private.

提交回复
热议问题