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 data type is true or false?

579


Differentiate between nested and inner class in java.

559


What do you mean by default constructor in java?

580


What is super keyword explain with example?

537


What are the different types of collections in java?

531






What is the console in java?

680


What is meant by distributed application? Why are we using that in our application?

555


What does java se mean?

593


Explain hashset and its features?

586


What is the role of garbage collector in java?

495


What is the difference between an array and an array list?

506


What is quick sort in java?

561


If a method is declared as protected, where may the method be accessed?

538


Why singleton class is used in java?

577


Can an interface extend a class?

542