How can final class be used?

Answer Posted / jayant gope

Final is keyword that can be used with class, method and also with the variable.

Class: When final is used with the class, it means that class cannot be further extended or inherited by the other classes. So, final keyword restricts class from being inherited.

Method: When final is used with the method, this means that method cannot be overridden.

Variable: When final is used with the variable, it makes the variable constant i.e. the variable cannot be further modified.

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is starvation?

687


os is developed in c no java is more secured then c na why dont the os developed is developed using java

3527


What is passed by reference and pass by value ?

586


What is the difference between import java.util.date and java .util?

575


What is hash in java?

523






What is arrays aslist in java?

523


Can you access non static variable in static context?

561


Why is multiple inheritance not supported in java?

564


How do you empty a list in java?

545


What is the base class in java from which all classes are derived?

523


What is instance example?

527


design an lru cache in java?

547


Explain an algorithm to find depth of a binary tree.

553


Can we override constructor?

543


Can we create an object of static class in java?

598