ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip   To Refer this Site to Your Friends   Click Here
Google
 
Categories  >>  Software  >>  Core Java  >>  Java J2EE  >>  Java Related
 
 


 

 
 Core Java interview questions  Core Java Interview Questions
 Advanced Java interview questions  Advanced Java Interview Questions
 Swing interview questions  Swing Interview Questions
 EJB interview questions  EJB Interview Questions
 Servlets interview questions  Servlets Interview Questions
 Struts interview questions  Struts Interview Questions
 JDBC interview questions  JDBC Interview Questions
 JMS interview questions  JMS Interview Questions
 SunOne interview questions  SunOne Interview Questions
 J2EE interview questions  J2EE Interview Questions
 Weblogic interview questions  Weblogic Interview Questions
 Websphere interview questions  Websphere Interview Questions
 Java Networking interview questions  Java Networking Interview Questions
 Java J2EE AllOther interview questions  Java J2EE AllOther Interview Questions
Question
Explain difference between final, finally and finalize?
 Question Submitted By :: Guest
I also faced this Question!!     Rank Answer Posted By  
 
  Re: Explain difference between final, finally and finalize?
Answer
# 1
When a class is marked final, it cannot be subclassed. When
a method is marked final, it cannot be overridden by the
subclass. And when a field is marked final, its value once
set, cannot be reset.

finally is the last clause in a try...catch block. It is a
block of statements that is executed irrespective if or if
not an exception was caught in the preceding try block.

finalize is a reserved method in Java, which can be
overridden by classes containing code to release any
expensive resources being held to by the object. Expensive
resources include, native peer objects, file/device/database
connections.
 
Is This Answer Correct ?    8 Yes 3 No
Ranganathkini
 
  Re: Explain difference between final, finally and finalize?
Answer
# 2
final:
  final keyword can be applied to vairables,method,class.
fianl variable - You can't reassign/modify values to the 
vaiables.
final class- You cannt extends(inherit) the class.
final method- You cannt override the final methods.

finally:

    finally is used in try-catch (i.e exception handling in 
java).
    Each try contain only one finally blocks not more than 
one.
    There is no statement between catch block and try block.
    It will be execute if exception is occure or not.     
    Mostly used for memeory release.

finalize:
     This is method used to release the occupied memeory.
      finally method must be protected or public otherwise 
compile time error.
 
Is This Answer Correct ?    15 Yes 2 No
Vijayakumar Chinnnasamy
 
 
 

 
 
 
Other Core Java Interview Questions
 
  Question Asked @ Answers
 
Why non nested classes in java are not having marked as protected access specifier Google1
What is a layout manager?  1
can we create object for static class in java Marlabs5
Real Time sample code for Encapsulation and Abstraction. where to use abstract and where to use specifies like public private.  1
What is casting ?  2
How Applets & Servlets will communicate with each other?  2
What is audio clip interface? Name few methods of it ?  1
class A{ m2(){ } } class B extends A{ m2(){ } } class c extends B{ m2(){ } } class my_class extends c{ m2(){ } pulic static void main(){ ...My_class a = new my_class(); super.super.super.m2(); is this is leagal if not find what is the legal procedure in order to call A's version of m2(); } Logica-CMG8
What is difference between Eclips and MyEclips?  2
Difference between Web-based applications,Client- Server applications and Distributed applications? Infosys2
What is more advisable to create a thread, by implementing a Runnable interface or by extending Thread class?  5
What is the difference between Resultset and Rowset. IBM5
what is main purpose of abstract class?  2
what is a static block?  4
How is Garbage collection done in Java? T3-Softwares2
why ,we are using jsp and html.which one is better? Photon1
What are field variable and local variable?  2
Difference between String and String Buffer?  3
how can we import the user defined package without classpath?  1
What is the difference between abstract class and interface?  2
 
For more Core Java Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com