• final is a keyword it is used to make something immutable for example if you want that you have declared a variable and you want that any how it’s value should not be changed by any one like derived class so you can use final keyword to make your variable immutable same process you can do for method if you declare method final then no one class can overload your method like println() method in system class is final and you don’t have authority to Overridde it and make some changes the reason is that if you have been given permission to do something like this then the abstraction will fail and now last you can use final keyword against the class if you declare a class final then you can’t extend the class and the perfect example of it’s String class in java


  • finally is a block and it is the assurance that if your code fails or not it will execute at the end but if you call System.exit(0) or your app terminates abnormally then definitely it will not run and now the use of finally is that you have connection of database but unfortunately your code throws the exception before you close the connection then there will be loss of resources so every time we create the connection make sure you are closing the connection in finally block


  • finalize is simply a method in object class it is called by garbage collector on an object when garbage determines that there is no more reference for these object

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s