承诺太虚伪
2017-04-20 22:31
int one = 10 ;
int two = 20 ;
int three = 0 ;
three=one+two;
three+=one;
three-=one;
three*=one;
three/=one;
three%=one;
System.out.println("three=one+two==>"+three);
System.out.println("three+=one==>"+three);
System.out.println("three-=one==>"+three);
System.out.println("three*=oneo==>"+three);
System.out.println("three/=one==>"+three);
System.out.println("three%=one==>"+three);
输出不对 都是0
重新实验的结果
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);
简单点这样不就行了,你那个为啥都是0,评论里有个哥们说了啦,那样写相当如不断重复赋值给three(最后一个three%=one;的结果为0),所以你输出的都是three=0(除开前面带的字符)
我建议改为这样,就会有你想要的结果啦!!!
为什么要分开呢 ?不分开 他会用哪个呢
Java入门第一季(IDEA工具)升级版
1165172 学习 · 17581 问题
相似问题