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;打印的值以three=0为基础从而输出10,而不是40.
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 = three+=one;
System.out.println("three+=one==>"+three);
three = three-=one;
System.out.println("three-=one==>"+three);
three = three*=one;
System.out.println("three*=one==>"+three);
three = three/=one;
System.out.println("three/=one==>"+three);
three = three%=one;
System.out.println("three%=one==>"+three);
}
}
int one = 10 ;
int two = 20 ;
int three = 0;
three=one+two;(改一下int a=one+two;)
System.out.println("three = one + two ==> "+three);(相应的这边对应为a)
three+=one;(此时设int b=a+one=one+two+one=40,three+=one=0)
System.out.println("three += one ==> "+three);