Link to home
Start Free TrialLog in
Avatar of riaancornelius
riaancornelius

asked on

What does final actually mean?

This is confusing me in a rather big way. If you declare something final, how does that affect it?
Avatar of girionis
girionis
Flag of Greece image

Hi riaancornelius,

a variable that is final means that it's value cannot be changed once you assign it. A method that is final means that it cannot be overriden and a class that is final means that it cannot be extended by any other class.

Cheers!
ASKER CERTIFIED SOLUTION
Avatar of girionis
girionis
Flag of Greece image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of riaancornelius
riaancornelius

ASKER

Thanks,
>> a variable that is final means that it's value cannot be changed once you assign it.
That's what was confusing me. Because I see a final JTable I assume you can't change anything in that JTable, but then in practice I see that the JTable's fields can still change.
I get it now. You can change anything in the final object, you just can't point that variable to a new object.

Thanks
> You can change anything in the final object, you just can't point that variable to a new object.

Exactly, you can change the values but not the reference to the JTable :)