Which methods can a subclass inherit in Java?

后端 未结 6 1445
说谎
说谎 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:43

    All public and protected methods and variables will be inherited. Any methods with the same signature in the subclass will override the superclass behavior. The subclass will not inherit private methods and variables. Default (a.k.a package visibility level) will be inherited if in the same pacakge and by subclasses.

提交回复
热议问题