Multiple choice technology programming languages

Select a correct answer

  1. Private methods cannot be overridden in subclasses

  2. A subclass can override any method in a superclass.

  3. An overriding method can declare that it throws more exceptions than the method it is overriding.

  4. The parameter list of an overriding method must be a subset of the parameter list of the method that it is overriding.

  5. The overriding method can have a different return type than the overridden method.

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

Private methods are not visible to subclasses and therefore cannot be overridden. A subclass can only override public and protected methods. An overriding method cannot declare more checked exceptions than the overridden method. The parameter list must match exactly (same number and types). The return type must be covariant (same type or subtype).