Java OCA OCP Practice Question 1338

Question

Suppose class aaa.MyClass has a method called callMe().

Suppose class bbb.MyClass2, which extends aaa.MyClass, wants to override callMe().

Which access modes for callMe() in aaa.MyClass will allow this?

  • A. public
  • B. protected
  • C. default
  • D. private


A, B.

Note

Public and protected methods may be overridden by any class.

A default method may be overridden only if the subclass is in the same package as the superclass.




PreviousNext

Related