为什么要运算一条之后输出再做下一条运算?
为什么不可以先将所有的算术运算完成之后再将所有的算术结果统一输出呢?
为什么不可以先将所有的算术运算完成之后再将所有的算术结果统一输出呢?
2018-06-12
也可以合并输出
public class HelloWorld{
public static void main(String[] args) {
int one = 10 ;
int two = 20 ;
int three = 0 ;
System.out.println("three:"+(three = one+two));
System.out.println("three:"+(three +=one));
System.out.println("three:"+(three -=one));
System.out.println("three:"+(three *=one));
System.out.println("three:"+(three /=one));
System.out.println("three:"+(three %=one));
}
}
举报