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

代码编写问题


int one=10; int two=20; int three=0;int three=one+two; 最后这句话为什么不对?three=one+two;这样写怎么就行?



提问者:Fighting_佳 2015-10-21 20:28

个回答

  • Perona
    2015-10-21 21:35:17
    已采纳

    声明一次数据类型就可以,不用反复声明。

    int three=0;

    这里已经声明过数据类型,所以接下来就不用再次声明数据类型。

  • 328992857
    2015-10-21 21:44:42

    同一变量,在一个域中只能声明一次兄弟