问答详情
源自: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.println("three = one + two ==>" + three );

        three += one;

        System.out.prinln("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 );

        


提问者:慕丝7272571 2020-07-03 17:20

个回答

  • 宝慕林2521228
    2020-07-03 22:36:18
    已采纳

    three /= one;  这个结果不是int类型了,而是double类型了。

  • 精慕门8058819
    2020-07-12 16:48:30

    +=  那块 println 少一个t 

  • 慕丝7272571
    2020-07-04 09:34:56

    把 one two three 定义为double类型吗

  • 慕丝7272571
    2020-07-04 09:30:18

    那应该怎么修改呢