Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

what are the differences between final,finally,finalize
methods?

Answer Posted / mukesh makwana

* final – constant declaration.

* finally – The finally block always executes when the try
block exits, except System.exit(0) call. This ensures that
the finally block is executed even if an unexpected
exception occurs. But finally is useful for more than just
exception handling — it allows the programmer to avoid
having cleanup code accidentally bypassed by a return,
continue, or break. Putting cleanup code in a finally block
is always a good practice, even when no exceptions are
anticipated.

* finalize() – method helps in garbage collection. A method
that is invoked before an object is discarded by the garbage
collector, allowing it to clean up its state. Should not be
used to release non-memory resources like file handles,
sockets, database connections etc because Java has only a
finite number of these resources and you do not know when
the garbage collection is going to kick in to release these
non-memory resources through the finalize() method.

Is This Answer Correct ?    14 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are loops in java?

1269


What are the topics in advance java?

970


How many types of array are there?

1008


Why synchronization is important?

1026


What is JVM and is it platform independent?

1051


Explain about serializable interface in java?

1001


When a thread is executing synchronized methods , then is it possible to execute other synchronized methods simultaneously by other threads?

1064


What is linkedlist in java?

1001


I want to store more than 10 objects in a remote server? Which methodology will follow?

3204


What is regex in java?

949


What is javac_g?

1018


Difference between a class and an object?

1037


What is the use of conditional statement?

985


Can an interface be defined inside a class?

1061


What is array and arraylist in java?

1107