728x90 자바 논리 연산자2 [JAVA] ch03-26. 논리 연산자 public class Ex26 { //논리연산자 public static void main(String[] args){ int x = 3; int y = 5; System.out.println("x is " + x + "y is " + y + ":"); System.out.println("x | y = " + (x | y)); System.out.println("x & y = " + (x & y)); System.out.println("x ^ y = " + (x ^ y)); System.out.println("true | false = " + (true | false)); System.out.println("true & false = " + (true & false)); System.out.printl.. JAVA/예제 2017. 8. 21. [JAVA] ch03-07. 논리 연산자 public class Ex07 {//논리연산자 public static void main(String[] args){ boolean power = false; //논리연산자는 boolean에서만 가능 System.out.println(power); power = !power; System.out.println(power); power = !power; System.out.println(power); } } JAVA/예제 2017. 8. 21. 이전 1 다음 728x90