public class Test {
public int aMethod() {
static int i = 0;
i++;
return i;
}
public static void main (String args[]) {
Test test = new Test();
test.aMethod();
int j = test.aMethod();
System.out.println(j);
}
}输出结果是什么?
# 0
# 1
# 2
编译失败
方法变量不能被声明为静态方法中