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 |
Why do we need autoboxing in java?
What is the alternate of 'Inheritance' ?
What is a method vs function?
can we have virtual functions in java?
What is sorting in java?
Why synchronization is important?
How will you add panel to a frame?
What is bigger kb or mb?
What is “try and catch” in java
How many types of memory areas are allocated by jvm?
worst case complexities of Quick sort and Merge sort.
Why vector is used in java?