What is the command to call one constructor from another constructor in the same class?



What is the command to call one constructor from another constructor in the same class?

A. super()

B. this()

C. that()

D. construct()

Answer:

B. this()

Explanation:

In Java, this() statement is used to call a constructor in the same class.

The super() statement is used to call a constructor in a parent class, while this() statement is used to call a constructor in the same class, making Option B correct and Option A incorrect. 

Options C and D are incorrect because they are not constructors.

Free Spring Boot Tutorial - 5 Hours Full Course


Watch this course on YouTube at Spring Boot Tutorial | Fee 5 Hours Full Course

Comments