猫味的橘子
2018-10-27 21:44
public class HelloWorld{
public static void main(String[] args) {
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);
}
}
代码没有问题,你是想问为什么最后输出结果为0吗?%是取余的意思,在最后一次输出中three的值为30,one的值为 10 取余为 0。
Java入门第一季(IDEA工具)升级版
1165172 学习 · 17581 问题
相似问题