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.
Loading...
Related Quiz
- What is the major drawback of Linear Search compared to other searching algorithms?
- If you do not specify any access level modifier, the default access level will be ________.
- The InetAddress class provides methods to get the IP address of a local computer by using method ________.
- What is the purpose of serialization in Java?
- Which index of a multi-dimensional array represents the row index in Java?