public class HelloWorld{ public static void main(String[] args) { int one = 10 ; int two = 20 ; int three = 0 ; System.out.println("three=one+two==>"+(three=one+two)); System.out.println("three+=one==>"+(three+=one)); System.out.println("three-=one==>"+(three-=one)); System.out.println("three*=one==>"+(three*=one)); System.out.println("three=/=one==>"+(three/=one)); //下划线里面的123(加号后面的)分别代表哪些数字?还是int里面的值么? }}
4 回答
已采纳
慕粉3233872
TA贡献70条经验 获得超29个赞
一个等号是赋值运算,两个等号是判断是否相等
(three=one+two)是把one和two两个值的和赋值给了three,这里输出的是运算后的three的值30。
(three+=one)相当于three=three+one,这里等号后面的three经过了上一次运算变成了30,30+10=40.
(three-=one)相当于three=three-one=40-10=30.
以此类推
添加回答
举报
0/150
提交
取消