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 is the use of finalize()Method
please explain with an example

Answer Posted / priyabrata patro

Once object is created than as java does not support delete keyword to delete the object , so , just imagine in our program when we create number of object than how it is deleted how memory occupied by this object recycled.
So,thankfully java supports gargage collector which is a program in jvm ,listen jvm is also a collection of program and garbage collector is one of them. Thus garbage collector is purely under cotrol of jvm .
So , now let us see what is the usage of finalize method .
When you go on creating the object , object occupies memory
and as memory is not infinite than you are prohibited to go on beyond the memory , but at that instance your program needs to have an object and memory is not available .So, there exactly we need finalize method to force garbage collector to recycle unused memory.
And you can say that as garbage collector is working why we need to use finalize method . As mentioned earlier that garbage collector is purely under control of jvm ,so jvm decides when it should work.okkk

Is This Answer Correct ?    8 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Define reflection.

950


What do you mean by scope of variable?

837


What are the 3 types of loops in java?

1003


Is java se free?

895


What is the largest number a double can hold?

988


What is purpose of applet programming?

1143


What are the high-level thread states in java programming?

1004


What is the advantage of preparedstatement over statement?

1055


Can we catch more than one exception in single catch block?

1002


What is internal iteration in java se 8?

1138


What is binary tree in java?

1013


Why are the methods of the math class static?

1032


Can subclass overriding method declare an exception if parent class method doesn't throw an exception?

1008


What is a java string?

1005


What is java english?

926