1 votes 1 votes Method over-riding can be prevented by using final as a modifier at ______. The start of the class. The start of method declaration. The start of derived class. The start of the method declaration in the derived class. Java ugcnetcse-aug2016-paper3 java method-overriding + – makhdoom ghaya asked Oct 1, 2016 • recategorized Oct 14, 2018 by Pooja Khatri makhdoom ghaya 2.5k views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
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 A_i_$_h answered Jun 17, 2017 A_i_$_h comment Share Follow See all 0 reply Please log in or register to add a comment.
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/ rishu_darkshadow answered Aug 27, 2017 rishu_darkshadow comment Share Follow See all 0 reply Please log in or register to add a comment.