問題文
A subclass declares a method whose name and parameter list match a private method of its superclass, and a call made through a superclass typed reference still runs the body that sits in the superclass. What does the language say about the pair of declarations, and why?
選択肢
- The subclass declaration is a separate method of its own, because a private method is placed beyond the reach of the subclass by the compiler, so the return type and the exceptions it declares are checked against the root class instead
- The subclass declaration overrides the private one, because a method that matches the name and the parameter list of an inherited one takes its place at run time, so the return type and the exceptions it declares must be substitutable
- The subclass declaration is a separate method of its own, because a private method is beyond overriding and beyond hiding in the technical sense of those words, so the return type and the exceptions it declares stand free of any relationship
- The subclass declaration overrides the private one, because the language widens the access of the inherited method to the level of the subtype, so the return type and the exceptions it declares are read as a refined form of the original