연산자 | 설명 |
---|---|
&& | AND |
|| | OR |
^ | XOR |
! | NOT |
int value1 = 1;
int value2 = 2;
if((value1 == 1) && (value2 == 2))
System.out.println("value1 is 1 AND value2 is 2");//true
if((value1 == 1) || (value2 == 1))
System.out.println("value1 is 1 OR value2 is 1");//true
if((value1 == 1) ^ (value2 == 1))
System.out.println("value1 is 1 XOR value2 is 1"); //true
if( !(value1 == 2))
System.out.printon("value 1 is 1")