首先给大家分享一个巨牛巨牛的人工智能教程,是我无意中发现的。教程不仅零基础,通俗易懂,而且非常风趣幽默,还时不时有内涵段子,像看小说一样,哈哈~我正在学习中,觉得太牛了,所以分享给大家!点这里可以跳转到教程
dead code无作用的代码
if (true & true) {
System.out.println("execute ok");
} else {
System.out.println("execute fail");
}
从else开始即为无作用。因为true&true在编绎时即知结果,所以else部分是无用的,编译器知道肯定不会执行的代码。
boolean a = true;
boolean b = true;
if (a & b) {
System.out.println("execute ok");
} else {
System.out.println("execute fail");
}
不会出现该问题,因为在编译时编译器不确定a & b是否恒成立。
原帖地址:http://hi.baidu.com/nicker2010/item/c00c521f01f1eeaffeded596