這邊的運算為什么不用前面加int?
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);
}
}這邊的運算為什么不用前面加int?
2016-04-17
因為你前面已經(jīng)定義過了,所以后面不需要再用int定義了