QTIN
2016-03-15 23:12
如示例 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);
输出的结果是
there = one + two ==>30
three += one ==>40
three -= one ==>30
three *= one ==>300
three /= one ==>30
three %= one ==>0
我想问一下当除等于的时候为什么是30 而不是3 根据示例说明 C/=A 相当于 C=C/A 。
或者在*=的时THREE的值已经变成了 300 才导致除等于是30的吗?? 求大神解答???
three = 300; one = 10; three /= one;//相当于 three = three / one; 相当于 three = 300 / 10; 所有就是30
这里的 = 是赋值号 ==才是等号
three在*=的时候值已经变成了300
Java入门第一季(IDEA工具)升级版
1165550 学习 · 17586 问题
相似问题