Suppose class MyClass
, in package packagea
, has a method called doSomething()
.
Suppose class MySubclass
, in package packageb
, overrides doSomething()
.
What access modes may MySubclass's version of the method have? (Choose all that apply.)
A, B.
Since the method in the superclass is overridden in a different package, the superclass version must be public or protected.
Default methods may be overridden only if the subclass is in the same package as the superclass; private methods may not be overridden at all.
An overriding method's access mode must be the same as, or more open than, the superclass version's access mode.