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

请教:3-3 java中的赋值运算符

请问练习题代码怎么写?没看懂要求。

提问者:一生一念一人 2017-07-14 15:15

个回答

  • 慕勒3185028
    2017-07-14 15:39:18
    已采纳

            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);
            //他的意思就是输出那样的结果,上面这是代码片段


  • 一生一念一人
    2017-07-14 15:46:28

    非常感谢。

  • 相遇1613499073
    2017-07-14 15:42:38

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

        }

    }