Answer Posted / vidya bhushan dwivedi
The variable should be declared as static and final. So only one copy of the variable exists for all instances of the class and the value can't be changed also.
static final int MAX_LENGTH = 50; is an example for constant.
| Is This Answer Correct ? | 6 Yes | 0 No |
Post New Answer View All Answers
Differentiate between the constructors and methods in java?
What will happen when using pass by reference in java?
Explain how hashmap works?
Where is jre installed?
what is the role of xml in core java?? and how we can use it?? can somebody give a sample program with explanation and from where i can read more about xml?????
What is struts in java?
What is pass by value?
Can string be considered as a keyword?
Why we use methods in java?
What are the advantages of java over cpp?
What do you understand by final value?
What is the purpose of static methods and variables?
Which is bigger float or double java?
What is difference between variable declaration and definition?
What is a char in java?