SCJP -- static method can not access non-static variable?
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成员?
请讨论,谢谢!
相关推荐
SCJP6 Sun Certificated Programmer for Java 6 Study Guide (Exam 310-065) 英文原版
Sun Certificated Programmer for Java 6 Study Guide (Exam 310-065) 1 Declarations and Access Control . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 2 Object Orientation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 3 Assignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183 4 Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287 5 Flow Control, Exceptions, and Assertions . . . . . . . . . . . . . . . . . . . . 327 6 Strings, I/O, Formatting, and Parsing . . . . . . . . . . . . . . . . . . . . . . . . 425 7 Generics and Collections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 541 8 Inner Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 661 9 Threads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 701 10 Development . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 789
【 Garfield 的 SCJP 閱讀筆記 阅读笔记
【 Garfield 的 SCJP 閱讀筆記 阅读笔记
SCJP必看英文词汇
网上找了些 自己又整理了一下 有不足的请给予补充
SCJP必掌握的英语词汇
SCJP必掌握的英语词汇,对于英语不好的可以参考一下
易语言游戏Call调用避坑指南:主线程绑定与反检测实战
本文详细解析了易语言游戏Call调用中的主线程绑定与反检测技术,帮助开发者避免游戏崩溃和断线问题。通过分析线程检测原理、提供易语言实现方案及高级反检测技巧,如动态线程绑定和上下文伪装,确保Call调用的稳定性和安全性。文章还包含常见问题排查和性能优化建议,适用于游戏辅助开发领域。


Java SE
