Notice
Recent Posts
Recent Comments
관리 메뉴

Developer Gonie

[1주차] 13. 관계연산자(<,>,>=, <=,!,&&,||) 본문

K-DigitalTraining 강의/1. Java

[1주차] 13. 관계연산자(<,>,>=, <=,!,&&,||)

이대곤 2022. 5. 18. 11:18

코드

public class Ex02_04_관계논리 {
	public static void main(String[] args) {
		int a=10, b=20;
		boolean c = a>b;
		System.out.println("a>b : " + c);
		System.out.println();
		
		System.out.println(a>b);
		System.out.println(a==b);
		System.out.println(a!=b);
		System.out.println(a>=b);
		System.out.println();
		
		boolean result= a>10 && b> 10;
		System.out.println(result);
		System.out.println(a>10 || b> 10);
		System.out.println();
		
		result= !(a>3);
		System.out.println(result);
	}
}

실행결과

a>b : false

false
false
true
false

false
true

false
Comments