SCJP -- static method can not access non-static variable?
class TestServer {
final int users = 20;
public TestServer() {
int users = this.users * 10;
}
public static void main(String [] args){
System.out.println("Variable users = " + users);
}
}
A. Output is 200.
B. Output is 20.
C. The file will compile, but will give an error when run.
D. The file will not compile
答案是不是应选D?因为static方法不能访问non-static成员?
请讨论,谢谢!