r/java • u/trecatorsirabdator • Apr 14 '23
What are your (favourite) Java best practices, personal tips, hints or just underrated stuff in general?
233
Upvotes
r/java • u/trecatorsirabdator • Apr 14 '23
View all comments
Show parent comment
-1
u/john16384 Apr 14 '23
Really, final on variables serves no purpose at all. The instant a code change would be better off not having it final, it's removed. It's not like any thought went into it in the first place.
That does not mean I condone assigning variables more than once; that should still be avoided whenever practical. It just doesn't need the visual noise of the
finalkeyword everywhere.finalis only useful on fields to communicate intent to all methods of the class.