CORE
HOME > JAVA > J2SE > CORE
2022.02.28 / 23:59

JAVA(ÀÚ¹Ù) - ÀÌÇ× ¿¬»êÀÚ 6.´ëÀÔ ¿¬»êÀÚ(=, +=, -=, *=, /=, %=, &=, ^=, |=, <<=, >>=, >>>=)

MyData
Ãßõ ¼ö 175


6.JAVA(ÀÚ¹Ù) - ÀÌÇ× ¿¬»êÀÚ 6.´ëÀÔ ¿¬»êÀÚ(=, +=, -=, *=, /=, %=, &=, ^=, |=, <<=, >>=, >>>=)

- ¿À¸¥ÂÊ ÇÇ¿¬»êÀÚÀÇ °ªÀ» ÁÂÃø ÇÇ¿¬»êÀÚÀÎ º¯¼ö¿¡ ÀúÀå

- Á¾·ù

 ¡Ü ´Ü¼ø ´ëÀÔ ¿¬»êÀÚ

 ¡Ü º¹ÇÕ ´ëÀÔ ¿¬»êÀÚ

     (Á¤ÇØÁø ¿¬»êÀ» ¼öÇàÇÑ ÈÄ °á°ú¸¦ º¯¼ö¿¡ ÀúÀå)

±¸ºÐ ¿¬»êÀÚ ¼³¸í
´Ü¼ø ´ëÀÔ ¿¬»êÀÚ º¯¼ö = ÇÇ¿¬»êÀÚ º¯¼ö = ÇÇ¿¬»êÀÚ
º¹ÇÕ ´ëÀÔ ¿¬»êÀÚ º¯¼ö += ÇÇ¿¬»êÀÚ º¯¼ö = º¯¼ö + ÇÇ¿¬»êÀÚ
º¯¼ö -= ÇÇ¿¬»êÀÚ º¯¼ö = º¯¼ö - ÇÇ¿¬»êÀÚ
º¯¼ö *= ÇÇ¿¬»êÀÚ º¯¼ö = º¯¼ö * ÇÇ¿¬»êÀÚ
º¯¼ö /= ÇÇ¿¬»êÀÚ º¯¼ö = º¯¼ö / ÇÇ¿¬»êÀÚ
º¯¼ö %= ÇÇ¿¬»êÀÚ º¯¼ö = º¯¼ö % ÇÇ¿¬»êÀÚ
º¯¼ö &= ÇÇ¿¬»êÀÚ º¯¼ö = º¯¼ö & ÇÇ¿¬»êÀÚ
º¯¼ö |= ÇÇ¿¬»êÀÚ º¯¼ö = º¯¼ö | ÇÇ¿¬»êÀÚ
º¯¼ö <<= ÇÇ¿¬»êÀÚ º¯¼ö = º¯¼ö << ÇÇ¿¬»êÀÚ
º¯¼ö >>= ÇÇ¿¬»êÀÚ º¯¼ö = º¯¼ö >> ÇÇ¿¬»êÀÚ
º¯¼ö >>>= ÇÇ¿¬»êÀÚ º¯¼ö = º¯¼ö >>> ÇÇ¿¬»êÀÚ
	public static void main(String[] args) {
		int result = 10;
		
		result += 10;
		System.out.println("result += "+result);
		
		result -= 5;
		System.out.println("result -= "+result);
		
		result *= 3;
		System.out.println("result *= "+result);
		
		result /= 5;
		System.out.println("result /= "+result);
		
		result %= 5;
		System.out.println("result %= "+result);
		System.out.println();
		
		À§ ½ÇÇà °ª:
		result += 20
		result -= 15
		result *= 45
		result /= 9
		result %= 4
		
		
		int result1 = 45;
		
		result1 &= 25;
		System.out.println("result1 &= "+result1);
		
		result1 |= 5;
		System.out.println("result1 |= "+result1);		
		
		result1 <<= 3;
		System.out.println("result1 <<= "+result1);
		
		result1 >>= 3;
		System.out.println("result1 >>= "+result1);
		
		result1 >>>= 3;
		System.out.println("result1 >>>= "+result1);
        
		À§ ½ÇÇà °ª:
		result1 &= 9
		result1 |= 13
		result1 <<= 104
		result1 >>= 13
		result1 >>>= 1
	}