What is the purpose of declaring a variable as final?

What is the purpose of declaring a variable as final?

Hi,

What is the purpose of declaring a variable as final?

Thanks

View Answers

April 11, 2013 at 1:44 PM

Hi,

In Java when we declare a final variable as a variable which has been initialized to a fixed value which cannot be changed after initialization. Once a variable declare/create as final its value never changed.

For more Details: http://www.roseindia.net/java/jdk7/variables.shtml

thanks,

Ads









Related Tutorials/Questions & Answers:
What is the purpose of declaring a variable as final?
What is an Abstract Class and what is it's purpose?
Advertisements
What is the purpose of org.hibernate.SessionFactory?
What is the purpose of data science ?
What is the importance of static variable?
What is use of a abstract variable?
What is use of a abstract variable?
What is instance variable in Java?
What is a transient variable?
What are the concepts and purpose of Spring configuration file.
What is the purpose of garbage collection in Java, and when is it used?
What is a local, member and a class variable?
ModuleNotFoundError: No module named 'nester_al_ali_finall'
global variable in objective c
Java - Declaring variables in for loops
delete retailer jsp file (sir..is this a good logic.. jsp file is useful for what purpose)
Declaring Data Types in Java
Rules for Declaring Variables in PHP.
Declare Reference variable
How to create variable in TensorFlow?
Difference between declaring variables before or in loop?
Local Variable and Instant Variable
environment variable
environment variable
Static Variable
Converting jsp variable to java variable
Passing variable
Instance variable in java
final variable
Writing for the Purpose of Reading
Application Variable

Ads