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

System.out.println(three%=one);

public static void main(String[] args) {

   int one = 10 ;

        int two = 20 ;

        int three = 0 ;

        System.out.println(three=one+two);

        System.out.println(three+=one);

        System.out.println(three-=one);

        System.out.println(three*=one);

        System.out.println(three/=one);

        System.out.println(three%=one);

30=10+20=30

30+=30+10=40

30-=40-10=30

30*=30*10=300

30/=300/10=30

30%=30%10=0?

%=是模等于什么叫模等于?

        这里我不懂啊?怎么是0?


提问者:大侃 2015-01-16 14:14

个回答

  • Fiona0126
    2015-01-16 14:36:45
    已采纳

    three=one+two ==> three = 10+20 = 30

    three+=one ==> three = three + one = 30+10 = 40  

    three-=one ==> three = three - one = 40 - 10 = 30

    three*=one ==> three = three * one = 30 * 10 =300

    three/=one ==> three = three / one  = 300 / 10 =30

    three%=one ==> three = three%one = 30%10 =0  //这里的意思是取余操作,30对10取余,不就是0吗~


  • Alex_0725
    2015-01-17 11:04:47

    %是求余 的方法。 30%10 是0  30%11 就是1咯。 以此类推