+ 15
In Java why final keyword is used to make the variable as a constant instead of there is a const keyword available???
4 Antworten
+ 4
Because the final is more flexible. Const would mean that the variable is always the same. But each object of a class could have it's own expression of a final value. That's the idea: Once you have made this thing, the value is final.
0
Not override
- 1
It is just the matter of the syntax i.e. in C & C++ we prefer using keyword const and in java final.