Originally posted by Swati Singhal:
Hi,
I am a lil confused with this question. Appreciate if somebody could clarify.
Which of the following constructors must exist in Parent class?
I thought the answer would be c, but it is both a & c.
You need both because the Child constructor
public Child(int i){ } has an implicit call to the compiler-provided, default, no-arg constructor of the parent (answer A).
Answer C is needed because of the explicit call to
super(i,j); in the Child constructor
public Child(int i, int j) Also note that the method
public void Child(int i, int j, int k) is NOT a constructor - since constructors don't have return types (and this method is declared to return void)
Hope this helps