Given: Which code fragment can be inserted at line //insert code here to enable the code to
compile?
A.
Cricket() { super(11, “Cricket”, “Condidtion OK”); num_umpires =3; num_substitutes=2; }
B.
Cricket() { this.num_umpires =3; this.num_substitutes=2; super(11, “Cricket”, “Condidtion
OK”); }
C.
Cricket() { super.ground_condition = “Condition OK”; super.name=”Cricket”;
super.num_players = 11; num_umpires =3; num_substitutes=2; }
D.
Cricket() { this(3,2); super(11, “Cricket”, “Condidtion OK”); } Cricket(int nu, ns) {
this.num_umpires =nu; this.num_substitutes=ns; }
answer B
@Boldoo : call to super() must be the first instruction in a constructor.
a
a
tested