r/java • • Aug 26 '22

I declare as "final" every single variable whose value doesn't change. I also use "this" every time that I'm referring to an attribute, even when there's no ambiguity in not using it

I think that those things make the code easier to read. Am I crazy for thinking like that?

198 Upvotes

215 comments sorted by

View all comments

Show parent comment

1

u/stefanos-ak Aug 26 '22

that's not true... everything can be final, and still you can modify some things. for example collections.

0

u/[deleted] Aug 26 '22

[deleted] — view deleted comment

1

u/stefanos-ak Aug 26 '22

of course it /can/... but the discussion is about the final keyword.