0

Can Constructor use both final and this keyword?

22nd Aug 2020, 11:24 AM
SABARISH V
SABARISH V - avatar
2 Réponses
+ 1
A constructor cannot be made final in Java since it is not subject to inheritance unlike methods. But yes you can use the this keyword inside constructor to initialize instance variables. The this keyword is a pointer to the current instance of the class.
22nd Aug 2020, 11:33 AM
Avinesh
Avinesh - avatar
0
inside constructor, you can use both.
22nd Aug 2020, 11:50 AM
zemiak