编译说illegal modifier for parameter i.
请告诉我我做错了什么.为什么我不能在Java构造函数中使用静态变量?
class Student5{
Student5() {
static int i = 0;
System.out.println(i++);
}
public static void main(String args[]){
Student5 c1 = new Student5();
Student5 c2 = new Student5();
Student5 c3 = new Student5();
}
}
Run Code Online (Sandbox Code Playgroud)