正如我们所知,在java 1.8静态方法被允许在接口中,我看到一些答案,如static methods defined in interface from jdk 1 8 why did they need to do so
但我不满意。
此外,我认为这可能会导致类似的问题:在java 1.8中的接口中添加的静态方法
public interface MyInterface{
public static void myMethod();
}
class MyClass{
MyInterface.myMethod(); // since myMethod is static but a huge error is waiting for us here ?
}
但我仍然认为这是一个出路的这一点,因为这是加入由专业人员,所以任何人都可以请解释甲骨文如何解决这个问题,有什么需要添加这个?
非常感谢您的光临。
我没有使用过的Java 1.8,所以我从来不知道,在Java静态方法需要定义不仅仅是声明,我一直以为接口作为纯抽象类我想这就是为什么这个想法定义一种方法对我来说似乎很陌生。感谢您的帮助 ! 。
你还没有显示实际问题*是* ... – 2014-09-19 12:41:36
这是一个很好的问题,我认为。 – 2014-09-19 12:42:38
你有没有试过_huge error_发生? – Narmer 2014-09-19 12:43:18