I have multiple constructors defined in a class. Is it possible to call a constructor from another constructor’s body?

By ayush goel in 22 Sep 2023 | 12:40 pm
ayush goel

ayush goel

Student
Posts: 346
Member since: 21 Sep 2023

I have multiple constructors defined in a class. Is it possible to call a constructor from another constructor’s body?

22 Sep 2023 | 12:40 pm
0 Likes
divas goyal

divas goyal

Student
Posts: 453
Member since: 22 Sep 2023

 Yes, in Java, you can call one constructor from another constructor in the same class using the `this()` keyword. This is called constructor chaining.

23 Sep 2023 | 04:05 pm
0 Likes

Report

Please describe about the report short and clearly.