1. 接口中错误语法
// Illegal modifier for the interface SomeInterface; ........................only public & abstract are permitted
// Illegal modifier for the interface field SomeInterface.someField; only public, static & final are permitted
// Illegal modifier for the interface method someMethod; ..............only public & abstract are permitted
2.接口编译自动追加缺省值
step1:
javac SomeInterface.java
step2:
open by Java Decompiler.exe
SomeInterface.java
package cn.zno.interfaze; interface SomeInterface { int someField = 0; void someMethod(); }
SomInterface.class
package cn.zno.interfaze; abstract interface SomeInterface { public static final int someField = 0; public abstract void someMethod(); }
以上是最终模式,在写接口时可以不写缺省值,但不可以填写缺省值以外的值
唯一可变是接口是通用还是包内可用及(public or 缺省 )