哦?这个在think in java上倒没有提到过。你的意思是否是指接口(interface)中的方法绝对不会有自变量,要使用自变量只能在基础类中?
public interface foo{ int k = 10; }接口中的变量必须在 声明时初始化Every field declaration in the body of an interface is implicitly public, static, and final. It is permitted to redundantly specify any or all of these modifiers for such fields. 接口中所有的变量都会被看成是一个 常量 所以后面的代码中是无法修改的
int k = 10;
}接口中的变量必须在 声明时初始化Every field declaration in the body of an interface is implicitly public, static, and final. It is permitted to redundantly specify any or all of these modifiers for such fields.
接口中所有的变量都会被看成是一个 常量 所以后面的代码中是无法修改的
这个i也是这样的初始化的?