Free Source Code and Tutorials

Custom Search

Final Keyword in Java

Final keyword in Java can be used with class, object, method and variables. It is used in order to restrict the user.

If final keyword is used along with the class, then that class cannot be extended.

If final keyword is prefixed before method then we will not be able to override that method.

If final keyword is used before variable/ object then we will not be able to reinitialize that object or variable.

  1. Syntax for using final keyword.
  3. public final class A{
  7. }
  9. public final void method1 {
  11. }
  13. final int temp;


If a user is trying to violate any rule, user will get compile time error.

Facebook Comments
(Visited 1 times, 1 visits today)
Share this

Check Your Domain Ranking

Leave a Reply

Your email address will not be published. Required fields are marked * © 2016 Frontier Theme

Subscribe For Latest Updates

Signup for our newsletter and get notified when we publish new articles for free!

%d bloggers like this: