问答详情
源自:3-3 Java中的赋值运算符

three-=one----------------three=three-one的值不是20吗,为什么是30​

three-=one----------------three=three-one的值不是20吗,为什么是30

提问者:车1366899 2020-10-14 11:08

个回答

  • 18级物三练月康32
    2020-10-14 14:06:16

      three -= one; (此处three=40,上一步得到的)  //three-=one ==40-10=30

            System.out.println(three);  //30

            three *= one;    //300

            System.out.println(three);

            three /= one;  //30

            System.out.println(three);

            three %= one;

            System.out.println(three);  0


  • weibo_慕少1561742
    2020-10-14 13:52:52

     int one = 10 ;

            int two = 20 ;

            int three = 0 ;

        

            three = one+two; = 30

            three += one;  =40

            System.out.println(three);  

            three -= one; (此处three=40,上一步得到的)

            System.out.println(three);

            three *= one;

            System.out.println(three);

            three /= one;

            System.out.println(three);

            three %= one;

            System.out.println(three);

     别忘了,three的值一直在变化