Final Keyword in Java | Example
→ final keyword is keyword this is non-access modifier.
Use of Final Keyword
There are there way use that is ..
1) Final Variable in Java
→ When it is initialized, we can not change the value of final variable so it is constant.
Output:- Compile Time Error
2) Final Method in Java
→ If you want to make any method as final, you can not override .
3) Final Class in Java
→ If a class is declare by a final keyword, it cannot be extended(inherited), because show Compile Time Error. that is called Final Class.
Compile Time Error