The keyword ________ is used within a constructor to call another constructor in the same class.

  • constructor()
  • extend()
  • super()
  • this()
In Java, the this() keyword is used within a constructor to call another constructor in the same class. This is called constructor chaining and allows you to reuse code logic among constructors in a class. The super() keyword is used to call a constructor of the superclass. The other options are not valid for constructor invocation.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *