2. What is Final Keyword in Java.. ?
• In the Java Programming Language, the final
Keyword is used in several different contexts to
define an entity which cannot later be changed.
3. Final Variables
• Any variable referenced as final is called Final
variable.
• Blank Final Variable.
• Final variables are by default read only.
4. Difference between const & Final
• The state of array declared as final can be modified in
Java.
• But Same is not possible in C / C++.
5. Final Methods
• Final method can not be overridden in sub-class.
• In methods private is equal to final, but in variables it
is not.
6. Final Classes
• Final class is complete in nature and can not be sub-
classed or inherited.
• Final and abstract are two opposite keyword and a
final class can not be abstract in Java.
7. Benefits of Final keyword
• Final keyword improves performance.
• It lets other programmers know that this variable
shouldn't be changed or assigned another value
• It stops you accidentally changing the value.
• It stops people overriding methods when you don't
want them to or they shouldn't.