recategorized by
2,542 views

2 Answers

0 votes
0 votes
i think option b

if it is used at the start of the class then it used to prevent  the class from being extended or subclassed not from being overridden

in order to prevent overriding,final keyword is placed at the start of the method
0 votes
0 votes

Ans: B

All methods and variables can be overridden by default in subclasses. If we wish to prevent the subclasses from overriding the members of the superclass, we can declare them as final using the keyword final as a modifier. If any attempt to override a final method in a subclass results in the compiler error. For example, in the following program, the method dataValues( ) is declared as final, it cannot be overridden in DataV2. If you attempt to do so, a compile error will result.

reference : http://hajsoftutorial.com/using-final-to-prevent-overriding/

Related questions

2 votes
2 votes
3 answers
1
makhdoom ghaya asked Oct 4, 2016
2,620 views
Java uses threads to enable the entire environment to be ______.SymmetricAsymmetricSynchronousAsynchronous
2 votes
2 votes
3 answers
3
1 votes
1 votes
3 answers
4
makhdoom ghaya asked Oct 4, 2016
4,088 views
Which formal system provides the semantic foundation for Prolog ?Predicate calculusLambda calculusHoare logicPropositional logic