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

Explain what is Marker interface?

696


How will you initialize an Applet?

704


What is an accessor?

1177


List two java ide’s?

716


What are three types of loops in java?

681






Can a constructor be private and how are this() and super() method used with constructor?

625


How objects of a class are created if no constructor is defined in the class?

669


Difference between string, string builder, and string buffer?

616


Why convert an applet to an application?

723


What is the properties class in java programming?

634


Can a constructor be made final?

758


What is difference between final and immutable?

655


Explain throw keyword in java?

688


Explain public static void main(string args[]).

657


What is nullpointerexception?

645