+ 6

Which keywords are used to achieve the constructor chaining in Java?

What type of keywords are used in constructor chaining

30th Dec 2018, 1:55 AM
hunaysubhash chennu
hunaysubhash chennu - avatar
8 Réponses
30th Dec 2018, 8:10 AM
hunaysubhash chennu
hunaysubhash chennu - avatar
+ 9
Use extends keyword
22nd Jan 2019, 9:07 AM
Aram Saleem
Aram Saleem - avatar
+ 4
Did you mean using a constructor of a class in another class. Usually using extends keyword works well with it. So a constructor defined in a class(A) can be used in the class(B) when instantiating it.
30th Dec 2018, 8:01 AM
Seniru
Seniru - avatar
+ 4
No we used to calling extends constructor by using the keywords Or keywords are used to creating chaining of same name constructor 's in class
30th Dec 2018, 8:06 AM
hunaysubhash chennu
hunaysubhash chennu - avatar
+ 3
hunaysubhash chennu sorry i didn't get what you said.
30th Dec 2018, 8:08 AM
Seniru
Seniru - avatar
+ 2
Super and this keywords
4th Jan 2019, 3:42 AM
Pallavi Malladi
+ 1
Super and this
4th Jan 2019, 10:35 AM
ADURTHI MOKSHAJNA
ADURTHI MOKSHAJNA - avatar
+ 1
To achieve Constructor chaining , super() method call is used whereas for local chaining this() method call. Super() method call takes the control from child class constructor to parent class constructor. This() method call takes the control to another constructor within the same class. Hope this helps.
7th Jan 2019, 6:59 PM
Mohammed Suhail
Mohammed Suhail - avatar