Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
可能重复: 为什么是 super.super.method(); 在 Java 中不允许?
Class A Class B extends A Class C extends B
如何让 C 类中的方法调用 A 类的超类?
我试过这个,但它失败了......
A.super.someMethod();
如果您打算调用super.super.someMethod()Java,那么简单的答案是您不能这样做。Java 故意禁止这样做,因为它违反了封装。
super.super.someMethod()