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:
“What is the difference between a taxidermist and a tax collector? The taxidermist takes only your skin.”
—Mark Twain [Samuel Langhorne Clemens] (18351910)
“The type of fig leaf which each culture employs to cover its social taboos offers a twofold description of its morality. It reveals that certain unacknowledged behavior exists and it suggests the form that such behavior takes.”
—Freda Adler (b. 1934)