将接口声明为抽象有什么意义?接口方法也是如此.有道理吗?
例如
公共抽象接口Presenter {public abstract void go(最终的HasWidgets容器);} 解决方案您是从哪里看到您发布的大量代码的,任何旧的 Java 代码库?这就是 JLS 必须说的:>
9.1.1.1 抽象接口:每个接口都是隐式抽象的.此修饰符已过时,不应用于新程序.
9.4 抽象方法声明:为了与旧版本的 Java 平台兼容,允许但不鼓励,作为一种风格,多余地指定抽象修饰符用于在接口中声明的方法.
What's point of declaring an interface as abstract? Same thing for an interface method. Is there a point to it?
eg.
public abstract interface Presenter { public abstract void go(final HasWidgets container); }解决方案
Where did you come across the chunk of code you have posted, any old java code base ? This is what the JLS has to say :
9.1.1.1 abstract Interfaces: Every interface is implicitly abstract. This modifier is obsolete and should not be used in new programs.
9.4 Abstract Method Declarations: For compatibility with older versions of the Java platform, it is permitted but discouraged, as a matter of style, to redundantly specify the abstract modifier for methods declared in interfaces.
更多推荐
为什么将接口声明为抽象接口?
发布评论