问答详情
源自:3-5 Java中的逻辑运算符

大佬来看一下我这个哪里错了?

public class HelloWorld {

    public static void main(String[] args) {

boolean a = true; // a同意

boolean b = false; // b反对

boolean c = false; // c反对

boolean d = true; // d同意

   System.out.println((a&&b)+"未通过");

        System.out.println((a||d)+"通过");

        System.out.println((!a)+"未通过");

        System.out.println((a^d)+"通过");

    

}

}


提问者:慕大海 2018-08-15 18:00

个回答

  • 小萝卜骑乌龟
    2018-08-16 19:01:45

    public class HelloWorld {
        public static void main(String[] args) {
            boolean a = true; // a同意
            boolean b = false; // b反对		
            boolean c = false; // c反对		
            boolean d = true; // d同意	   
            System.out.println((a&&b)+"未通过");        
            System.out.println((a||d)+"通过");        
            System.out.println((!a)+"未通过");←        
            System.out.println((a^d)+"通过"); ←   	}}


  • 慕大海
    2018-08-15 18:03:04

    最后两个分号错误,应是(;)真是看瞎眼,2333