赋值运算符

来源:3-3 Java中的赋值运算符

橙汁梨儿

2021-04-12 20:49

这怎么写啊,有大佬给我示范一下么

写回答 关注

3回答

  • weixin_慕桂英0467466
    2021-05-15 23:40:20

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

  • weixin_慕的地8373765
    2021-04-23 15:39:51

            int one = 10 ;

            int two = 20 ;

            int three = 0 ;

            int a=one+two;

            System.out.println("three = one + two==> "+a);

            System.out.println("three += one ==> "+(a+=one));

            System.out.println("three -= one ==> "+(a-=one));

            System.out.println("three *= one ==> "+(a*=one));

            System.out.println("three /= one ==> "+(a/=one));

            System.out.println("three %= one ==> "+(a%=one));


  • 慕仔10573827
    2021-04-13 14:38:01

    =,把等号右边的数据赋值给等号左边的变量或常量

    +=,a += b,等效于:a = (a的数据类型)(a + (b));

    -=,a -= b,等效于:a = (a的数据类型)(a - (b));

    =,a = b,等效于:a = (a的数据类型)(a * (b));

    /=,a /= b,等效于:a = (a的数据类型)(a / (b));

    %=,a %= b,等效于:a = (a的数据类型)(a % (b));

    weixin...

    不一定要输满的

    2021-05-15 23:41:28

    共 2 条回复 >

Java入门第一季(IDEA工具)升级版

0基础萌新入门第一课,从Java环境搭建、工具使用、基础语法开始

1165171 学习 · 17581 问题

查看课程

相似问题