View RSS Feed

Recent Blogs Posts

  1. Final, finally and finalize

    by , 01-08-2012 at 12:38 PM
    • final – It’s a constant declaration.

    • finally – It handles exception. It is an optional block to write at the end of your exception handling block. It is usually used to close files, close database connections and statements. Also release all other resources in this block.

    • finalize – This method is called by the garbage collector. Garbage collector always called this method before it performs garbage collection on that object. It should not be used to release ...
    Categories
    Access Modifier
  2. Final keyword improves performance

    by , 05-21-2011 at 11: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