17.6k views
1 vote
What is wrong with the following code? public class ClassB extends ClassA { public ClassB() { int init = 10; super(40); } } Group of answer choices a) The call to the method super must be the first statement in the constructor. b) The method super is not defined. c) No values may be passed to super. d) Nothing is wrong with this code.

1 Answer

6 votes

Answer:

The second statement super(40), should come before the statement int init = 10

Step-by-step explanation:

The line of code implements a constructor in Java. In this constructor, the execution of call to the method super needs to be completed before the initialization of the variable int init

User Azamat  Mirvosiqov
by
6.4k points