Question 52Asked in UGC NET Computer Science, August 2016 (Paper II & III, Selected Questions)

Method over-riding can be prevented by using final as a modifier at

  1. Athe start of the class.
  2. Bthe start of method declaration.
  3. Cthe start of derived class.
  4. Dthe start of the method declaration in the derived class.
Show answerHide answer

Correct answer: (B) the start of method declaration.

Explanation

To disallow a method from being overridden, specify final as a modifier at the start of its declaration. Methods declared as final cannot be overridden.

From UGC NET Computer Science PYQ, August 2016 (Paper II & III, Selected Questions)

This is question 52 of UGC NET Computer Science PYQ, August 2016 (Paper II & III, Selected Questions). See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.