java中 & ,&&
- && 短路与判断
public class ImoocStudent {
public static void main(String[] args) throws Exception{
if(1 > 2 && 10/0 == 0)// 执行报错,0不能作为分母
{
System.out.println("******");
}
if(1 > 2 & 10/0 == 0)// 执行不报错,还没运行到&&的第二个条件
{
System.out.println("******");
}
}
}
- 同样的 || 短路或判断
相信坚持的力量,日复一日的习惯.

浙公网安备 33010602011771号