问答详情
源自:3-3 Java中的赋值运算符

我标记的地方报错了,麻烦看下为什么错了。谢谢

package COM.HelloWorld;

public class Jiafa {
 public static void main(String[] args){
    int one = 10 ;
    int two = 20 ;
    int three = 0 ;
    intthree=one+two;   
    int three1=three+=one;
    int three2=three1-=one;
    int three3=three2*=one;
    int three4=three3/=one;
    int three5=three4%=one;
    System.out.println(three);
    System.out.println(three1);
    System.out.println(three2);
    System.out.println(three3);
    System.out.println(three4);
    System.out.println(three5);
   
   
   
   
   

}
}


提问者:大00峰 2016-11-19 16:54

个回答

  • qq_变好的坏人_04336920
    2016-11-19 17:02:04
    已采纳

    前面用int定义了three后面就不需要重新定义了,而且后面定义的时候中间还没有空格键

  • zhangjiuding
    2016-11-19 17:00:14

    int 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;

    System.out.println(three);