Important Java Mcq 1

Which of the following statements is incorrect with respect to overriding?

a. When overriding a method, the names and type signatures of the override method must be the same as the virtual method that is being overridden.

b. overriding happens at runtime.

c. It is necessary to override a virtual method.

d. None of the above

Answer:

c. it is necessary to override a virtual method

Explanation:

It is not mandatory for the derived class to override (or re-define the virtual function), in that case, the base class version of the function is used. A class may have a virtual destructor but it cannot have a virtual constructor.

Related MCQs
Aniket Malik

Aniket Malik

CERTIFIED TUTOR/TRAINER WITH 300+ REVIEWS

Facing difficulty with

this concept?