How to define a constant variable in Java?
Answer / 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 |
Can we declare a class as static?
How many types of syncronization?
How do you sort in java?
Discuss different types of errors that generally occur while programming.
What is a stream? what are the different types and classes of Streams?
Can we initialize the final blank variable?
What is the smallest package in Java API?
What is unicode?
Why do I need to declare the type of a variable in java?
What is the purpose of the enableevents() method?
Difference in the use of print, println, and printf.
Difference between prefix and postfix forms of the ++operator?