+x
, -x
, !x
, ...x = y
, x < y
, x != y
, ...조건식 : true ? false
+
, -
, *
, /
, %
//
는 없는듯?+=
, -=
, *=
, /=
, %=
>
, <
, >=
, <=
, ==
, !=
++
--
package testPJT2;
public class MainClass {
public static void main(String[] args) {
int a = 10;
System.out.println("++a : " + (++a));
//결과 ++a : 11
//a = a + 1과 동일한 코드임
int b = 10;
System.out.println("--b : " + (--b));
//결과 --b : 9
int c = 10;
System.out.println("c++ : " + (c++));
System.out.println("c : " + c);
/*결과
c++ : 10
c : 11
*/
int d = 10;
System.out.println("d-- : " + (d--));
System.out.println("d : " + d);
/*결과
d-- : 10
d : 9
*/
}
}
&&
a && b
||
a || b
!
!a
: a의 상태를 부정조건식 ? 식1: 식2
식1 if 조건식 else 식2
package testPJT2;
public class MainClass {
public static void main(String[] args) {
int x = 10; int y = 20;
String result;
result = (x > y) ? "x is best" : "y is best";
System.out.println("result : " + result);
}
}
//결과
//result : y is best
데이터를 비트 단위로 환산해 사용
연산 속도가 향상된다
&
|
^