Bird
0
0

Which of the following is the correct syntax to chain constructors in Java?

easy📝 Syntax Q12 of 15
Java - Inheritance
Which of the following is the correct syntax to chain constructors in Java?
Athis.call(); // calls another method
Bsuper(); // calls constructor of same class
Cthis(); // must be the first statement in constructor
Dconstructor(); // calls constructor by name
Step-by-Step Solution
Solution:
  1. Step 1: Recall syntax for constructor chaining

    Constructor chaining uses this(...) as the first statement inside a constructor.
  2. Step 2: Identify correct option

    this(); // must be the first statement in constructor shows this(); which is the correct syntax to call another constructor in the same class.
  3. Final Answer:

    this(); // must be the first statement in constructor -> Option C
  4. Quick Check:

    Constructor chaining syntax = this() first [OK]
Quick Trick: Use this() as first line to chain constructors [OK]
Common Mistakes:
  • Using super() to call same class constructor
  • Calling constructor by its name directly
  • Placing this() after other statements

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Java Quizzes