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

帮看看对吗

{
    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-=one==>"+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);
   
 }
}

提问者:qingan 2018-09-12 20:00

个回答

  • H慧
    2018-09-12 20:30:47
    已采纳

    three=one+two;

    three%=one;

    这两处的分号你用的中文格式。

  • 瑞瑞d
    2018-09-12 20:18:42


        public static void main(String[] args) {
         int one = 10 ;
            int two = 20 ;
            int three = 0 ;
        three=one+two;//在此处three的值已经是20了
        System.out.println("three=one+two==>"+three); 
        three+=one; //three的值变成了30
        System.out.println("three+=one==>"+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);
        three%=one;
        System.out.println("three%=one==>"+three);
        
     }
    }