Make private methods final?

Adding final to methods does not improve performance with Sun HotSpot. Where final could be added, HotSpot will notice that the method is never overridden and so treat it the same.

In Java private methods are non-virtual. You can’t override them, even using nested classes where they may be accessible to subclasses. For instance methods the instructoin to call privates is different from that used for non-privates. Adding final to private methods makes no odds.

As ever, these sort of micro-optimisations are not worth spending time on.

Leave a Comment