多选题
What is the effect of the following line of code?
super()
A. The method that is overridden by the current method is called.
B. The parent class's constructor is called.
C. The current class's constructor is called.
D. The child class's constructor is called
E. The current method is recursively called.
A
B
C
D
E
【正确答案】
B
【答案解析】
在这个示例中,super关键字用于调用父类的构造函数。这必须在当前类构造函数的第一行使用。A、C、D和E不正确。A不正确,因为引用一个被重写的方法,必须使用super和该方法名。C不正确,因为this()应该用于调用类的正确构造函数。D不正确,因为不可能引用一个子类的方法。E不正确,因为super与递归毫无关系。
提交答案
关闭