Explain Final keyword in java? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

Explain Final keyword in java?

9th Sep 2017, 7:07 AM
ⓢⓐⓝⓓⓔⓔⓟ
ⓢⓐⓝⓓⓔⓔⓟ - avatar
2 Answers
+ 7
final, when used on a type identifier creates a constant. That constants value can not be changed and will throw an error if attempted. When the final keyword is used on a classes method, that method can not be overridden in a sub class. When the final keyword is used on a class, that class can not be inherited from or extended.
9th Sep 2017, 8:17 AM
ChaoticDawg
ChaoticDawg - avatar
+ 1
Final acts as a reserved word in Java that is used before declaring a variable and assigning a value to it. This means the value remains fixed throughout the program.
4th Jan 2019, 2:22 AM
Candice Dick
Candice Dick - avatar