賦值運(yùn)算符的除等于 求大神解答??
如示例 int one = 10 ;
? ? ? ?int two = 20 ;
? ? ? ?int three = 0 ;
? ? ? ?three = one + two;
? ? ? ?System.out.println("there = one + two ==>" + three);
? ? ? ?three += one;
? ? ? ?System.out.println("three += one ==>" + three);
? ? ? ?three -= one;
? ? ? ?System.out.println("three -= one ==>" + three);
? ? ? ?three *= one;
? ? ? ?System.out.println("three *= one ==>" + three);
? ? ? ?three /= one;
? ? ? ?System.out.println("three /= one ==>" + three);
? ? ? ?three %=one;
? ? ? ?System.out.println("three %= one ==>" + three);
輸出的結(jié)果是
there = one + two ==>30
three += one ==>40
three -= one ==>30
three *= one ==>300
three /= one ==>30
three %= one ==>0
我想問(wèn)一下當(dāng)除等于的時(shí)候?yàn)槭裁词?0 而不是3 根據(jù)示例說(shuō)明 C/=A 相當(dāng)于 C=C/A 。
或者在*=的時(shí)THREE的值已經(jīng)變成了 300 才導(dǎo)致除等于是30的嗎?? 求大神解答???
2016-03-15
2016-03-15
這里的 = 是賦值號(hào) ? ? ==才是等號(hào)
2016-03-15
three在*=的時(shí)候值已經(jīng)變成了300