慕粉3251371
2016-04-26 12:39
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); } }
我看了下问答,有人说three=one+two前面不用加上int,是因为前面已经定义过了,不用打上去。
那我有个疑问,那为啥打上去int会报错?看起来即时打上int也不会影响算法,那为什么会报错?求各位指教。
前面定义过了three不能重复定义
Java入门第一季(IDEA工具)升级版
1165550 学习 · 17586 问题
相似问题