Benefit from the final | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

Benefit from the final

Very dubious use of finals in class discriptions

18th Oct 2019, 7:06 AM
Максим Суманеев
Максим Суманеев - avatar
2 Réponses
0
If your intention is to ask what is final keyword in java. Final is used to define constant. If you want any variable to be constant through your execution then you can use final. It's value can never be changed. Declaration: Final x =0; Final PI = 3.14; Etc And in final class you can't inherit final class. See, like if you want your class not be inherit for defining something in your class like variable which are need to be used in one class only. etc
18th Oct 2019, 7:43 AM
Chirag Kumar
Chirag Kumar - avatar
0
Declaring constant variables final will save resources. If you don't mark a variable, that is not supposed to be changed, to final, program will waste resources just for being ready to change the variable state.
18th Oct 2019, 9:13 AM
Seb TheS
Seb TheS - avatar