View RSS Feed

My Java Tips

  1. Final keyword improves performance

    by , 05-21-2011 at 10:10 PM (My Java Tips)
    Its right to say that final keyword improves performance. For example, if you declare a method as final, then you cannot override it in derived classes. When this is told to compiler in advance using final keyword, it improves performance.

    Java Code:
    public final void doSomethng()
    {
    ...
    }
    Knowing that a method cannot be overridden, complier inline that method into its derived classes.
    Final variables, especially static final variables, ...
    Tags: final Add / Edit Tags
    Categories
    Performance