在 Java Language Specification, 3e 中有这么一段话:An instance method m1 declared in a class C overrides another instance method, m2, declared in class A iff all of the following are true:1. C is a subclass of A.
2. The signature of m1 is a subsignature (§8.4.2) of the signature of m2.
3. Either
* m2 is public, protected or declared with default access in the same package as C, or
* m1 overrides a method m3, m3 distinct from m1, m3 distinct from m2, such that m3 overrides m2.我想请问,最后一句 m1 overrides a method m3, m3 distinct from m1, m3 distinct from m2, such that m3 overrides m2 是什么意思?如果说成“m1 覆盖了方法 m3,m3 既不同于 m1,也不同于 m2,所以 m3 覆盖了 m2”,好像于理不通。

解决方案 »

  1.   

    最后的整句话是m1覆盖m2的一个条件,不应该像楼主那样理解为一个结论吧
    可能这样翻译更好:m1覆盖m3,m3不同于m1和m2,而m3覆盖了m2,(由此得出m1覆盖了m2)
      

  2.   

    哦,我明白了。
    这里的 such that 不是 so that 的变换形式,而是说“如此这样的一个m3”!这个定义看多了就看晕了……多谢!