Explain final, finalize() and finally?

Answer Posted / venkataramana

final is a keyword.
we can use the final keyword in different context.
final keyword can be used with 1.Variables
2.Methods
3.Classes

When we use the final keyword with variables ,the value of
the final variable will not be changed i.e its value will be
fixed .

when we use the final keyword with methods, that is the
final method cannot be overridden.

when we use the final keyword with classes, that is the
final class cannot be extended to subclasses.

Finally() block is followed after try() or catch() block.
Finall() block executed even though if there the exception
having or not in the program.

Is This Answer Correct ?    8 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is Gang of four design patterns

794


Can we write class inside a class in java?

729


How do you remove an object from an arraylist in java?

652


Explain the difference between static and dynamic binding in java?

787


Can we extend singleton class?

707


Tell me are there implementations for sorting and searching in the java libarary?

804


What are the disadvantages of using inner classes?

746


Is there any difference between nested classes and inner classes?

790


How would overload a function based on return type?

749


Explain the difference between treeset and treemap in java?

737


What is contractor means and methods?

755


Can list be final in java?

682


What is difference between static and abstract class?

726


Explain the difference between map and flatmap stream operation?

1014


What is the Scope of Static Variable?

931