- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我有一个这样的界面:
public interface SuperInterface {
public interface SubInterface {
public void get();
}
//**More interfaces*/
}
我的工具包中的这个方法,它检索作为某个类实例的所有对象:
public static ArrayList getSome(ArrayList
MyClass 不是很有趣,它是一个从 SuperInterface.SubInterface
这部分主要是:
ArrayList
第一个方法调用没有像我希望的那样工作,第二个方法调用。是否有可能使第一个工作没有明确地将子接口(interface)放在不同的文件中并实现父类(super class)?因为显然子接口(interface)不是真正的子接口(interface),所以我尝试像这样创建接口(interface)类:
public class ClassWithInterfaces {
public interface Super { }
public interface Sub implements Super { /**...*/ }
}
但显然您不能在内部接口(interface)中使用thực hiện
。
Câu hỏi của tôi là:为什么会这样,是否有办法实现我想要实现的目标(一个文件中的内部接口(interface))?我不一定需要它,我只是想知道为什么它不能在内部接口(interface)中实现(但可以扩展内部类)。
câu trả lời hay nhất
But apparently you can't use
thực hiện
in an inner interface.
您正在寻找mở rộng
thay vìthực hiện
:
public class ClassWithInterfaces {
public interface Super { }
public interface Sub extends Super { /**...*/ }
}
这为我编译,我当然可以实现这两个接口(interface)。
由于扩展与实现之间似乎存在一些混淆,以下内容可能有助于澄清问题:
关于Java 泛型 : why can't inner interface implement from a (inner) superinterface?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13818592/
假设我得到了这个接口(interface) A: interface A { void doThis(); String doThat(); } 所以,我想要一些抽象类来实现 doTh
在 JLS 和 JVM 规范中,都有引用类的直接 super 接口(interface)的语言。类的直接 super 接口(interface)的概念令人困惑,因为类不能扩展接口(interface)
问题:我有两个具有相同限定路径的 java 类。 我正在运行一个 EMR 作业,为此我将所有依赖项 jar 打包在一个 jar 中并上传到 S3。 EMR 集群应该使用来自 S3 的这个 jar。但我
我有类 Assembly 实现 IAssembly。 启动应用程序时出现以下错误 Caused by: java.lang.IllegalAccessError: class cannot acce
我有一个这样的界面: public interface SuperInterface { public interface SubInterface { public void
Tôi là một lập trình viên xuất sắc, rất giỏi!