Difference From The C++ const
Type Qualifier
A final variable in Java means that variable can't be reassigned after initialization. C++ const
can be used in this way (SomeClass * const ptr
). The more common use SomeClass const * ptr
means that the data being referenced can't be modified, although the reference itself can be changed to refer to different data. Both usages of C++ const
can be combined (SomeClass const * const ptr
).
Java's final
is a hard rule. If you have a final variable, you cannot reassign it.
Read more about this topic: Final (Java)
Famous quotes containing the words difference and/or type:
“No burst of nuclear phenomenon
That put an end to what was going on
Could make much difference to the dead and gone.”
—Robert Frost (18741963)
“We need a type of theatre which not only releases the feelings, insights and impulses possible within the particular historical field of human relations in which the action takes place, but employs and encourages those thoughts and feelings which help transform the field itself.”
—Bertolt Brecht (18981956)