咱們經常遇到abstract class與 interface的區別,今天卻遇到了abstract interface,感受interface不用abstract再修飾了啊。結論:事實也確實如此,編譯爲.class文件後abstract interface成爲了interface。java
package com.abstractinterface; public abstract interface DaemonUserSignal { public abstract void signal(); }
package com.abstractinterface; public interface DaemonUserSignal2 { public abstract void signal(); }
編程後結果比較:git
D:\git\concurrent_crypto\target\classes\com\abstractinterface>javap DaemonUserSignal.class Compiled from "DaemonUserSignal.java" public interface com.abstractinterface.DaemonUserSignal { public abstract void signal(); } D:\git\concurrent_crypto\target\classes\com\abstractinterface>javap DaemonUserSignal2.class Compiled from "DaemonUserSignal2.java" public interface com.abstractinterface.DaemonUserSignal2 { public abstract void signal(); }