Java OCA OCP Practice Question 1327

Question

Fill in the blanks:

___ methods must have a different list of parameters,

while ___ methods must have the exact same return type.

  • A. Overloaded, overridden
  • B. Inherited, overridden
  • C. Overridden, overloaded
  • D. None of the above


D.

Note

Option A seems like the correct answer, but the second part of the sentence is false, regardless of whether you insert overloaded or overridden.

Overridden methods must have covariant return types, which may not be exactly the same as the type in the parent class.

Option D is the correct answer.




PreviousNext

Related