Important Java Mcq 1

Which of the following is true regarding method overriding?

a. An overridden method advocates for inheritance in OOP.

b. A method in the subclass that has the same name, same arguments, and same return type as a method in the superclass is overridden.

c. It is not possible to access the method which is overridden in a subclass.

d. An overridden method in java is called a virtual function.

Answer:

b. A method in the subclass that has the same name, same arguments, and same
return type as a method in the superclass is overridden.

Explanation

Overriding method has the same name, number and type of parameters, and
return type as the method that it overrides. An overriding method can also return a subtype
of the type returned by the overridden method. This subtype is called a covariant return
type.

Related MCQs

The main method header is written as?

a. public static void main(string[] args) b. public static void Main(string[] args) c. public static void main(Strings[] args) d. public static void main(String[] args) Answer:

Aniket Malik

Aniket Malik

CERTIFIED TUTOR/TRAINER WITH 300+ REVIEWS

Facing difficulty with

this concept?