Polymorphism and Constructors

后端 未结 2 816
栀梦
栀梦 2020-12-28 07:53

I am an AP Java Student and I am practicing for my exam. I came across this question and I don\'t understand the answer:

Consider the following classes:

<         


        
2条回答
  •  隐瞒了意图╮
    2020-12-28 08:49

    The base class must be constructed before the derived class.

    First A() is called which calls methodOne() which prints B.

    Next, B() is called which prints *.

提交回复
热议问题