[JAVA] 연산자

hi·2021년 11월 27일

1. 증가/감소 연산자

(단항 연산자)

++ , -- : 값을 1만큼 늘리거나 줄인다

++num : 대입 후 출력
num++ : 출력 후 대입

ex) 

int a = 10;

	System.out.println(++a); // 11 출력
	System.out.println(a);   // 11 출력


int b = 20;

	System.out.println(b++); // 20 출력
	System.out.println(b);   // 21 출력

2. 조건 연산자

(삼항 연산자)

조건? 참: 거짓;

3. 논리 연산자

&& : and
|| : or
! : 부정

0개의 댓글