public class HelloWorld{
public static void main(String[] args) {
int one = 10 ;
int two = 20 ;
int three = 0 ;
int three1 = one + two ;
System.out.println("three=one+two==>"+three1) ;
int three2 += one ;
System.out.println("three+=one==>"+three2) ;
int three3 -= one ;
System.out.println("three-=one==>"+three3) ;
int three4 *= one ;
System.out.println("three*=one==>"+three4) ;
int three5 /= one ;
System.out.println("three/=one==>"+three5) ;
int three6 %= one ;
System.out.println("three%=one==>"+three6 ) ;
}
}
你可以这样写只输出一个three变量,每一行按three += one; System.out.println(three);这样的形式就可以了