时代风云
2016-10-11 15:55
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);
three /= one;
System.out.println("three /= one ==>"+three);
three %= one;
System.out.println("three %= one ==>"+three);
输出的结果为:
three = one + two ==>30
three += one ==>40
three -= one ==>30
three *= one ==>300
three /= one ==>30
three %= one ==>0
倒数第二个结果不应该是3吗?three/=one不就是三十除十的结果吗?怎么是30呢?还有为什么每个输出的结果都是大于输出的值呢?
three = one + two; //此时three=10+20=30
three += one;//此时three=30+10=40
three -= one;//此时three=40-10=30
three *= one;//此时three=30*10=300
three /= one;//此时three=300/10=30
three %= one;此时three=30/10的余数0
Java入门第一季(IDEA工具)升级版
1165552 学习 · 17587 问题
相似问题
回答 2
回答 4
回答 1
回答 3
回答 3