Is there an advantage to declaring a private method as "final" in Java?
If my understanding is correct, the "final" Modifier makes sure I cannot override a method in a subclass and so this may make this method more efficient during runtime. Some literature says it can be inlined if it is final for example which may make the method call faster. Also, the Java runtime won't have to go look for other method in the inheritance hierarchy if it is declared final.
However, private functions cannot be overriden, so are they implicitly "final" as well? Is there a difference between the following two declarations:
private void myFun()
and
private final void myFun();