慕少1317773
2020-03-24 13:12
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 -= 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); 如上:第10行和11行,three -= one; 按等价应该是three=three-one 也就是30-20 = 10 为什么输出是three -= two ==>30
你后面打印的是three-=two,但前面做的却是three-=one,
实际上是40-10=30,所以打印出来的也是30.
Java入门第一季(IDEA工具)升级版
1165537 学习 · 17586 问题
相似问题