为什么我这个报错a

来源:3-3 Java中的赋值运算符

宋瑾

2021-05-28 16:21

public class HelloWorld{

    public static void main(String[] args) {

   int one = 10 ;

        int two = 20 ;

        int three = 0 ;

        

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

    

}

}


写回答 关注

1回答

  • 慕神1136790
    2021-05-29 21:31:33

    第7、8、9行前面已经不该有int,前面已经定义了。删除这三行,或者删除int即可。

Java入门第一季(IDEA工具)升级版

0基础萌新入门第一课,从Java环境搭建、工具使用、基础语法开始

1163350 学习 · 17551 问题

查看课程

相似问题