What is Final Keyword in Java?

1 votes
404 views
Anonymous User asked 20-Dec-2017 in Technology by Anonymous User

What is Final Keyword in Java? 

1 Answer

0 votes
Harsh kumar srivastava answered 20-Dec-2017 by Harsh kumar srivastava

What is Final Keyword in Java?

Final keyword is used to make a constant variable, whose value is never changed. We can also say that when we use the final keyword with variables in Java, to specify it's values are not to be changed.

In Java, we declared a constant using the Keyword Final. Value can be assigned to the variable defined using Final keyword is only once and after assignment, the value of constant (a variable declared using final keyword) can't be changed.
In Java, the Final keyword is used to restrict the user. You can use the Final keyword with many contexts in Java. Which are as follows:
(i). variable
(ii). method
(iii). class
While we declared a Class by using Final Keyword, it can't inherit by a class or in other words it cannot be subclassed.

Hope it's informative...