day03_FlowEx1

육희영·2021년 9월 1일
0

if, else 참, 거짓

package day03;

public class FlowEx1 {

	public static void main(String[] args) {
		int x = 0; // x=1로 바꿔서도 테스트 해보자.
//		System.out.printf("x=%d일떼, 참인것은 %n", x);
//
//		if (x == 0)
//			System.out.println("x == 0");
//		if (x != 0)
//			System.out.println("x != 0");
//		if (!(x == 0))
//			System.out.println("!((x == 0))"); // x!=0
//		if (!(x != 0))
//			System.out.println("!((x != 0))"); // x == 0
		
		if (x == 1) {
			System.out.println("참");
			
		} else {
			System.out.println("거짓");
		}
	}

}

출력결과

거짓

0개의 댓글

관련 채용 정보