How can final class be used?

Answer Posted / user

One scenario where final is important, when you want to prevent inheritance of a class, for security reasons. This allows you to make sure that code you are running cannot be overridden by someone.

The best example is
public final class String

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the static keyword?

586


What are the features of java?

527


Can one thread block the other thread?

599


What is a variable simple definition?

572


What does %4d mean in java?

839






Does java allow overriding static methods ?

624


What is the size of integer?

581


Explain the term virtual machine?

583


What are the differences between heap and stack memory in java?

530


What does exclamation mean in java?

567


How to declare objects of a class ?

584


What are the rules for variable declaration?

496


What is anti pattern in java?

512


How many bits is a string in java?

572


What is the ==?

461