凡塵
2015-12-30 14:09
/85/1298/BUlD/HelloWorld.java:8: error: ';' expected
int three += one ;
^
/85/1298/BUlD/HelloWorld.java:8: error: not a statement
int three += one ;
^
/85/1298/BUlD/HelloWorld.java:10: error: ';' expected
int three -= one ;
^
/85/1298/BUlD/HelloWorld.java:10: error: not a statement
int three -= one ;
^
/85/1298/BUlD/HelloWorld.java:12: error: ';' expected
int three *= one ;
^
/85/1298/BUlD/HelloWorld.java:12: error: not a statement
int three *= one ;
^
/85/1298/BUlD/HelloWorld.java:14: error: ';' expected
int three /= one ;
^
/85/1298/BUlD/HelloWorld.java:14: error: not a statement
int three /= one ;
^
/85/1298/BUlD/HelloWorld.java:16: error: ';' expected
double three %= one ;
^
/85/1298/BUlD/HelloWorld.java:16: error: not a statement
double three %= one ;
^
10 errors
不要加int 再次声明了,声明一次就可以额
不要重复声明变量的数据类型,声明一次就够了。three声明了好几回数据类型。就好比一个人,都声明是男人,反复声明他是男人没多大意义。
参考代码
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); } }
Java入门第一季(IDEA工具)升级版
1165172 学习 · 17581 问题
相似问题