Given these code fragments:
What is the outcome?
A method declared in an interface is implicitly public. Tool.export() correctly implements it as public, but ReportTool.export() attempts to override that method with package-private access. An overriding method cannot reduce the access level of the inherited method, so compilation fails at line n2.
public
Tool.export()
ReportTool.export()
Community Discussion