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

3-3练习题

int one = 10 ;        int two = 20 ;        int three = 0 ;                three=one+two;        three+=one;        System.out.println("three=one+two==>"+three);        System.out.println("three+=one==>"+three); 结果都是40为啥?

提问者:慕粉1749238652 2017-11-01 14:21

个回答

  • 南泉彬哥
    2017-11-03 23:39:46

    你把顺序调换一下,就清楚了:

    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);