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

为什么 three = one + two;不能int three = one + two 吗

        int three = one + two;

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

        int three += one;

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

        int three -= one;

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

        int three *= one;

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

        int three /= one;

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

        int three %= one;

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

为什么不要加int。。。。。

提问者:孙涛虎 2019-09-10 23:22

个回答

  • 慕工程0123645
    2019-09-19 13:21:29

    three在那之前已经用int定义过了、