Contact Us || Privacy Policy || About Us |
|
Final Keyword in Java | Example→ final keyword is keyword this is non-access modifier. Use of Final KeywordThere 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. Example:- Output:- Compile Time Error ![]() Example2:- Output:- ![]() 2) Final Method in Java→ If you want to make any method as final, you can not override . Example:- 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. Example1:- Output Compile Time Error ![]() Example2:- Output ![]() |