GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  J2EE  >  Core Java
Go To First  |  Previous Question  |  Next Question 
 Core Java  |  Question 430 of 502    Print  
Is finalize() method really recommended in a java program? Justify

  
Total Answers and Comments: 1 Last Update: August 20, 2007     Asked by: sandeep 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
August 20, 2007 06:31:09   #1  
sivakumar_govin Member Since: January 2007   Contribution: 1    

RE: Is finalize() method really recommended in a java ...

Using finalize() method in java is not a recommended solution to release the system resources used by an object.

The finalize() method will be called before deleting an object. An object in java will be deleted only by a garbage collector. The execution of garbage collector depends upon the JVM implementation. It is not guaranteed that when a garbage collector will be invoked and so its not a good idea to rely on this method.

Instead of this method using finally block to free these resources is more reliable. Because a finally block always gets executed.

 
Is this answer useful? Yes | NoAnswer is useful 0   Answer is not useful 1Overall Rating: -1    

 Related Questions

Latest Answer : Memory leaks are possible in Java. There is a possibility that the garbage collector may never even run during an application's lifetime, even if it is explicitly invoked by calling System.gc(). The garbage collector won't be automatically run ...

Latest Answer : JavaBeans are just regular class files. They have get and set methods only. They are not controlled by separate EJB server like JBOSS etc, They can easily work on JVM itself and they dont require any application/EJB server.EJB'S also have get and ...

Will there be a performance penalty if you make a method synchronized? If so, can you make any design changes to improve the performance

Latest Answer : Java is only pass-by-value language. Passing a reference is not possible though you can pass by value. If you want changes to reflect back then consider the primitive type in a custom class not a wrapper class i.e., to say, this class will have getter ...

Latest Answer : yes a method can be static and synchronized ...

Latest Answer : The main differences are: Java does not support typedefs, defines, or a preprocessorJava supports classes, but does not support structures or unionsJava does not support multiple inheritanceJava does not support operator overloadingJava does not support ...

Latest Answer : Only through Interface. ...

Latest Answer : Primary Advantages is, we don't need to add code in Java Class(attribute, Mutator Method[get/set]), Sipmply we can add new attributes by modifying XML files. Eg . ActionForm and DynaActionForm in Struts FrameWork. ...

Latest Answer : primtive datatyp is non object datatypeint chat short byte long float double boolean ...

Latest Answer : Yes. Every thread maintains its own separate stack, called Runtime Stack but they share the same memory. Elements of the stack are the method invocations, called activation records or stack frame. The activation record contains pertinent information ...


 Sponsored Links

 
Related Articles

Service Oriented Java Business Integration Review

Service Oriented Java Business Integration Review Introduction If you ve read through the texts which give you an introduction to SOA or Web Services you will often find them to be quite frustrating and the reason for this is because they spend too much time referencing business processes which are
 

Java and Client Server Models

Java and Client Server Models The Role of Client Servers on the Web Client server models provide the essential mechanisms for working with the Internet In fact most of the World Wide Web is built according to this paradigm In client server models the web browsers run by millions of users are the cli
 

What is Common Data Modeling Method

Common Data Modeling is one of the core considerations when setting up a business data warehouse. Any serious company wanting to have a data warehouse will have to be first serious about data models. Building a data model takes time and it is not unusual for companies to spend two to five years just
 

How to develop compile and run a C program

The steps involved in building a C program are: 1. First program is created by using any text editor and the file is stored with extension as .c 2. Next the program is compiled. There are many compilers available like GNU C compiler called as gcc, Sun compiler, Borland compiler which is pop
 

The Interview Snafu

How to turn someone else’s mistake to your advantage Your dream job is about to become reality. A recruiter gave you the heads up about the perfect position at Humungous Conglomerate, Inc. You went through five interviews as well as a battery of psychological tests mandated by their HR de
 

Winning a Job Interview with a Winning Resume

Does your resume unlock your potential, take your skills to the highest level and win you the interview and the job you want now? The job market today is highly competitive and even if you think you have what it takes to get an interview you won’t get over the line without a polished, prof
 

JavaScript Window Object Open Method Part 2

JavaScript Window Object Open Method Part 2 In this JavaScript tutorial you will learn about JavaScript Window Object Open Method features of window object open method scrollbars status titlebar toolbar top width innerHeight innerWidth outerHeight outerWidth and hotkeys mosgoogle center scrollbars S
 

JavaScript Window Object Open Method

JavaScript Window Object Open Method In this JavaScript tutorial you will learn about JavaScript Window Object Open Method features of window object open method channelmode directories dependent fullscreen screenX screenY height left location menubar resizable alwaysLowered alwaysRaised mosgoogle ce
 

Using UML with Java

Using UML with Java While Java is not a new language its application for the development of embedded systems is quite new Developers are beginning to take a second look at modeling languages such as UML and many feel it can be a powerful tool in their development arsenal mosgoogle center Introductio
 

Importance of Proper English during Job Interview

Importance of Proper English during Job Interview Your job interview is crucially important and it will determine whether or not you will get the job Depending on the type of job you re going for it is very important for you to use proper English In most cases jobs which offer higher salaries will h
 

About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape