[자바 연산자] 8. 관계연산자

김건우's avatar
Feb 04, 2025
[자바 연산자] 8. 관계연산자
💡
== x와 y가 같은가? > x가 y보다 큰가? > = x가 y보다 크거나 같은가?
! = x와 y가 다른가? < x가 y보다 작나? < = x가 y보다 작거나 같은가?
package ex02; public class CompOperator { public static void main(String[] args) { System.out.print((3 == 4) + " "); System.out.print((3 != 4) + " "); System.out.print((3 > 4) + " "); System.out.print((4 > 3) + " "); System.out.print((3 == 3 && 4 == 7) + " "); // 하나만 거짓이면 전체가 거짓 System.out.print((3 == 3 || 4 == 7) + " "); // 하나만 참이면 전체가 참 } }
notion image
 
Share article

gunwoo