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

看了好多遍还是不知道那里错了,请大神指教?

public class HelloWorld{

    public static void main(String[] args) {

    int one = 10 ;

        int two = 20 ;

        int three = 0 ;

       three=one+two;

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

        three+=one;

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

        three-=one;

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

        three*=one;

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

        three/=one;

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

        three%=one;

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

    

        

        

        


提问者:离觞殇 2019-03-01 21:33

个回答

  • weixin_慕的地5091890
    2019-03-01 22:35:57
    已采纳

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

    }

    }

    我给你改完了,你看看你的代码和我写的是不是一样。注意两点结尾的}你有几个。println这个单词是否打对了。

  • 慕用8557428
    2019-03-09 18:49:28

    + three在一开始加一次就可以了吧。不用在每个打印里都加一次把。如果加的话,会重叠。

  • Pandorac
    2019-03-01 21:49:10

    System.out.println