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 |
What does the “static” keyword mean? Can you override private or static method in java?
what is the use of abstract class?
3 Answers Amdocs, Atos Origin, Invictus,
Can a static method be final?
What is the return type of the main method?
Explain about OOPS concepts and fundamentals.
What does int [] mean in java?
Is it possible to define a method in java class but provide it’s implementation in the code of another language like c?
What is the default value stored in Local Variables?
why are there separate wait and sleep methods? : Java thread
Can you add null to a list java?
What is strings in java?
What all methods are used to prevent thread execution ?