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

Why java is not 100% object-oriented?

820


What is += mean in java?

536


Which package has light weight components in java programming?

667


Is arraylist zero based?

547


what do you mean by marker interface in java?

539






What does 0 mean in boolean?

533


Give few examples of final classes defined in Java API?

696


What does the ‘static’ keyword mean? Is it possible to override private or static method in java?

555


What is double in java?

506


What are some alternatives to inheritance?

551


Explain listiterator and methods in listiterator?

539


Which sorting algorithm is in place?

531


What is bigger kb or mb?

575


What are the two ways to create a thread?

526


What does int [] mean in java?

524