Java basics about final keyword

finaljavamethods

Can final keyword be used for a method?

Best Answer

Absolutely! The final keyword can be applied to just about anything, in each case meaning "you don't get to change this anymore."

Here's what it means when applied to...

a variable: You simply cannot assign the variable a new value (rendering it a constant, of course)

a method: You cannot re-implement (i.e., override) this method in a subclass

a class: You cannot define a subclass

In each case we're simply indicating: once this thing is declared, this is the last value (or implementation) you'll ever see for it.