728x90

 

 


public class practice_everyday01 {
	public static void main(String[] args) {	
		
		// 전위, 후위 증가연산자 
		// =전치,후치
		int a = 1;
		int b = 2;
		int ab = ++a + b; // (1+1) + 2 = 4 : a=2 b=2 ab=4
		int c = 3;		  //				 c=3
		int ac = a + c--; // 2 + 3 = 5 : a=2 b=2 c=2 
		int bc = ++b - c; // 3 - 1 = 1 : a=2 b=3 c=2
		
		System.out.println(a);
		System.out.println(b);
		System.out.println(c);
		System.out.println(ab);
		System.out.println(ac);
		System.out.println(bc);
		
			
	}
}
728x90
반응형

+ Recent posts