1). Final
In Java, Final keyword is modifiers for Class, Method, Variable.
if final class is define so you can't extend a class.
if final method is, so you can't override method.
if final variable , so variable is like constant. no one can change as constant.
2). Finally
In Java, Finally is a Block. always associated with the try catch block.
ex. try{
//risky code.....
- - - -
- - - -
}catch(exception e){
- - - -
//for handling code
}
finally{
//for clean up....
}
is clean up like , can you close up database connection...
3). Finalized
In Java, Finalized is method. Present in class. which class? is object class.
so, who is called finalized method?
When create object then the garbage collector pointing to the object.garbage collector is destroy your object or unnecessary memory assigning to the object. so object may destroy because garbage collector is job like destroying object. so you need to clean up garbage collector. and that want to use finalized method to clean up garbage collector.
ex. obj.finalized(){
//clean up activity
}
- - - - - - - - - - - -
Definition : Finalized() is method which is always invoked by garbage collector just before destroying an object to perform a clean up activity.
- - - - - - - - - - - -
Comments
Post a Comment