비교연산자 < > == /=
System.out.println('A'>'B'); //65>66
String s1 = "abc";
String s2 = "abc";
System.out.println(s1==s2);//true로 나오긴 하지만
System.out.println(s1.equals(s2));//이퀄스로 사용해라
논리연산자 and or
&&가 ||보다 우선순위가 높다
i%2==0 || i%3==0 //i가 2의 배수 또는 3의 배수이다.
(i%2==0 || i%/3==0) && i%6!=0 //i는 2의 배수
또는 3의 배수지만 6의 배수는 아니다
//'0'<=ch && ch <= '9' //문자 ch는 숫자이다
//('a' <= ch && ch <= 'z') || ('A' <= ch && ch <= 'Z')
//문자 ch는 소문자 또는 대문자이다.
// 소문자 또는 대문자
논리 부정 연산자 !
boolean b = true;
System.out.println(!b);
System.out.println(!!b); // !!true-> !false -> true
조건연산자
조건식?식1:식2
참이면 식1, 거짓이면 식2
result = (x > y)? x : y
int c = 10;
int d = 5;
System.out.println("//////////////////");
System.out.println(c>d?"true":"false");
System.out.println(d>c?"true":"false");
복합 대입연산자
i += 1; i = i + 1;
i *= 10 + j; i = i * (10+j);