(1) Two public classes in the same file. (illegal)
同一个文件里有两个public类。(非法)
(2) Main method calling a non-static method. (illegal)
在main(String[] args)方法内调用一个非静态方法。(非法)
(3) Methods with the same name as the constructor(s). (这种题常有)
与Constructor(s)有相同名字的方法。
(4) Thread initiation with classes that do not have a run() method.
(常考之题) 初始化了一个没有run()方法的线程类。
(5) Local inner classes trying to access non-final vars. (illegal)
内部类尝试访问非final变量(非法)
(6) Case statements with values out of permissible range. (byte,int, short,chat)
选择语句case中,没有使用允许的值。如(byte,int,short,char)等
(7) Math class being an option for immutable classes !! (totally wrong!)
Math类作为不可改变类。(完全错误) (请提意见)
(8) instanceOf is not same as instanceof.
instanceOf 不是 instanceof。
(9) Private constructors. (legal)
私有 的Constructor。 (合法)
(10)An assignment statement which looks like a comparison.
一个 赋值语句 看起来像 比较语句。
比如说if(a=true),和if(a==true)。对于这种题眼睛亮一点。
(11)System.exit() in try-catch-finally blocks. (finally 不会执行)
在try-catch-final块中的退出语句。 (finally不会执行)
(12)Order of try-catch-finally blocks matters. (若顺序错的话: error: No try before catch)
try-catch-final块的顺序问题。
(13)main() can be declared final. (OK)
main()方法 可以声明为 final.
(14) -0.0 == 0.0 is true.
(15)A class without abstract methods can still be declared abstract
没有抽象方法的类,仍然可以定义为抽象类。
下一篇:到底该不该去考JAVA认证? 一直都有人很仿徨地这么问我。对于此问题,我认为不应该简单地回答 Yes 或 No。根据你的背景以及对自己期许的不同,答案也会不一样。
我们都希望在职场上得到别人的肯定,许多人都认为取得认证代表一种技术上的肯定,但在我看来,这其实是大有疑问的。至少我们都同意,在台湾考到驾照不见得就会开车,会开车不见得就开得好,否则台北市的交通也就不会这么紊乱了。也因此,当越来越多通过认证的人在工作上却无法达到该有的水准时,许多雇主对于认证的信心也难免大打折扣。
在软件产业的知识经济一文中,我...[Java/2008-3-31/193101154.shtml">查看详情] |