[Java] 복합 할당 연산자(Compound Assignment Operators)(예제)

dancingcarrot·2023년 3월 8일

Java

목록 보기
10/11

  1. CompAssignTest01.java
public class CompAssignTest01	{
	public static void main(String[] args) {
    
    	int x=100;
    
    	x+=10;	//x=x+10
    	System.out.printf("x += %d\n", x);
    
    	x=100;
    	s-=10;	//x=x-10
    	System.out.prtinf("x -= %d\n", x);
    
    	x=100;
    	x*=10;	//x=x*10
    	System.out.printf("x *= %d\n", x);
    
    	x=100;
    	x/=10;	//x=x/10
    	System.out.printf("x /= %d\n", x);
   }
}    

0개의 댓글