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 |
How are this() and super() used with constructors?
Explain about field hiding in java?
Is java free for commercial?
What does the @override annotation do?
what are upcasting and downcasting?
Is java a pure object oriented language?
What does you mean in math?
Tell me the programme for this @ 1 2 @ @ @ 1 2 3 4
5 Answers Accenture, iGate, IntoNET, Value Labs,
How do you compare objects in java?
Is it possible to do method overloading and overriding at a time
Why java is considered dynamic?
Suppose there is an Online shopping cart application having different objects like Cart, SelectionItem, Billing, COnfiguration, Authentication, Authorization, PersonalDetails etc. Out of this which one can be made a singleton pattern and why?