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

大神求解=_=

int one = 10 ; int two = 20 ; int three = 0 ; three=one+two; System.out.println("three=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); //"为啥我都看不懂?"; } }

提问者:慕后端7185459 2018-07-23 15:00

个回答

  • 妮妮慕莱坞3017812
    2018-07-23 15:21:34

    //定义整型one,two,three,并赋初值

    int one = 10 ; int two = 20 ; int three = 0 ; 

    //计算one+tow(也就是计算10+20),并赋值给three

    three=one+two; 

    //输出three(也就是输出10+20)

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

    //等同于three=three+one;就是将one+three重新赋给three(也就是30+10),并输出three

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

    //等同于three=three-one;就是将three-one重新赋给three(也就是20-10),并输出three

     three-=one; System.out.println("three-=one==>"+three);

    //等同于three=three*one;就是将three*one重新赋给three(也就是10*10),并输出three

    three*=one; System.out.println("three*=one==>"+three);

  • 孤独的小猪
    2018-07-23 15:16:21

    这个你哪一句看不懂,前面就是声明变量,然后对每个变量进行不同的赋值运算符处理,打印出来