子敬正在创造自己的人生
需求有轻重缓急,功能有可控不可控。 需求有版本有截止(否则会无休无止),功能不可控变为可控。 集中兵力消灭敌人有生力量,集中优势兵力消灭敌人有生力量。

Why is it necessary for an interface to be "declared" abstract?

It's not.

public abstract interfaceInterface{
       \___.__/|'---->Neither this...

public void interfacing();

public abstract boolean interfacing(boolean really); \___.__/|'----> nor this, are necessary.}

Interfaces and their methods are implicitly abstract and adding that modifier makes no difference.

Is there other rules that applies with an abstract interface?

No, same rules applies. The method must be implemented by any (concrete) implementing class.

If abstract is obsolete, why is it included in Java? Is there a history for abstract interface?

Interesting question. I dug up the first edition of JLS, and even there it says "This modifier is obsolete and should not be used in new Java programs".

Okay, digging even further... After hitting numerous broken links, I managed to find a copy of the original Oak 0.2 Specification (or "manual"). Quite interesting read I must say, and only 38 pages in total! :-)

Under Section 5, Interfaces, it provides the following example:

public interface Storing{

  void freezeDry(Stream s)=0;
  
  void reconstitute(Stream s)=0;
}

And in the margin it says

In the future, the " =0" part of declaring methods in interfaces may go away.

Assuming =0 got replaced by the abstract keyword, I suspect that abstract was at some point mandatory for interface methods!

refer from:http://stackoverflow.com/questions/7202616/java-abstract-interface

posted on 2013-05-31 09:34  silentjesse  阅读(198)  评论(0编辑  收藏  举报