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
Explain restrictions on using enum?
What is early binding and late binding in java?
How does singleton class work?
Java Compiler is stored in JDK, JRE or JVM?
What are the basic concepts of OOPS in java?
Which data type is a class in java?
Explain aggregation in java?
Explain heap sort?
What is the purpose of using bufferedinputstream and bufferedoutputstream classes?
What is the difference between final, finally and finalize() in java?
what is interface in java? Explain
How do you square a number?
What is collection class in java? List down its methods and interfaces.
Can we assign null to double in java?
What are the three types of design patterns?