java中 & ,&&

发布时间 2023-06-01 11:22:30作者: 盘思动
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("******");
        }

    }

}