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

老师,请指点

public class HelloWorld{

    public static void main(String[] args) {

   int one = 10 ;

        int two = 20 ;

        int three = 0 ;

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

        System.out.println(three+=one);

        System.out.println(three-+one);

        System.out.println(three*=one);

        System.out.println(three/=one);

        System.out.println(three%=one); 

}

}

是这样吗?但是输出后面的==〉30怎么输出?

提问者:qq_城主_0 2015-08-17 13:34

个回答

  • qq_城主_0
    2015-08-18 12:38:00

    应该是这样的,

    public class HelloWorld{

        public static void main(String[] args) {

            int one = 10 ;

            int two = 20 ;

            int three = 0 ;

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

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

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

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

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

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

    }

    }

    有个问题,是不是用双信号括起来的直接就可以输出不用再判断了,没有用双信号的语句是否要判断运算呢?