我有两个接口(interface)Interface1
和Interface2
,如下所示:
public interface Interface1 {
int x = 10 ;
}
public interface Interface2 {
int y = 20
}
我想调用Interface1
中y
的Interface2
值。是否可以?如果是的话你能告诉我怎么走吗?
最佳答案
接口(interface)中的字段隐式为 public
static
和 final
。
只需引用Interface2.y
即可。
关于java - java中另一个接口(interface)中的接口(interface)数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28089785/