JAVA의 연산자



( X-- | --X임,,)

int x = 1;
int y = 2;
int res;
int x = 20;
int y = 15;
int res;
// + 연산자
System.out.println(res = x + y); // 20 + 15 = 35
// - 연산자
System.out.println(res = x - y); // 20 - 15 = 5
// * 연산자
System.out.println(res = x * y); // 20 * 15 = 300
// / 연산자
System.out.println(res = x / y); // 20 / 15 = 1
// % 연산자
System.out.println(res = x % y); // 20 % 15 = 5

https://colossus-java-practice.tistory.com/19 참고할것..
1) 비교 연산자

int x = 10;
int y = 12;
boolean z = x < y; // true
boolean z = x > y; // false
boolean z = x == y; // false
boolean z = x != y; // true
2) 비교 연산자

int x = 20;
int y = 30;
boolean z = x < y || (x = x + 15) > y; // true
boolean z = x = y && (x = x + 15) > y; // false




int age = 22;
String adult = age > 20 ? "성인입니다." : "성인이 아닙니다.";
>> "성인입니다." trues값.

int num = 120;
num += 30; // num = num + 30;
nnum -= 30; // num = num - 30;
...
참고 문서