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,









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's the purpose of constructor in abstract class?
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?
What is the purpose of the following files having extensions: frm, myd, and myi? What these files contain?
ModuleNotFoundError: No module named 'nester_al_ali_finall'
If the variable $a is equal to 5 and variable $b is equal to character a, what?s the value of $$b?
Java - Declaring variables in for loops
global variable in objective c
delete retailer jsp file (sir..is this a good logic.. jsp file is useful for what purpose)
Declaring Data Types in Java
I am trying to assign a variable the value of 0123, but it keeps coming up with a different number, what’s the problem?
I am trying to assign a variable the value of 0123, but it keeps coming up with a different number, what’s the problem?
Rules for Declaring Variables in PHP.
Declare Reference variable
Java variable
Difference between declaring variables before or in loop?
How to create variable in TensorFlow?
Local Variable and Instant Variable
environment variable
environment variable
Static Variable
the Struts if being used in commercial purpose.
Converting jsp variable to java variable
Pointer a variable
Passing variable
final variable
type casting purpose
Writing for the Purpose of Reading
Instance variable in java
Application Variable
how to assign javascript variable value to a jsp variable
Java as a general purpose language
define string variable in php
php variable functions
static variable in php
ModuleNotFoundError: No module named 'all-purpose-dict'
ModuleNotFoundError: No module named 'all-purpose-set'
ModuleNotFoundError: No module named 'all-purpose-set'
ModuleNotFoundError: No module named 'Multi-Purpose-Arduino-Controller'
ModuleNotFoundError: No module named 'Multi-Purpose-Arduino-Controller'

Ads