亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

請問這兩組代碼有什么不同的意義?為什么會得到不同的結果?

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

public class HelloWorld{
??? public static void main(String[] args) {
???? int one = 10 ;
??????? int two = 20 ;
??????? int three = 0 ;
??????? three=one+two;???
??????? three+=one;????
??????? three-=one;?????
??????? three*=one;?????
??????? three/=one;??
??????? three%=one;

??? System.out.println("three=one+two==>"+three);???

??? System.out.println("three+=one==>"+three);?

??? System.out.println("three-=one==>"+three);??????

????System.out.println("three*=one==>"+three);?

??? System.out.println("three/=one==>"+three);

??? System.out.println("three%=one==>"+three);
???????
???????



正在回答

1 回答

意義是不同的,計算機在編譯的時候是按照順序的,所以你看到第一組代碼的輸出three的值是不一樣的,但是第二組代碼的輸出值都是同一個

1 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

請問這兩組代碼有什么不同的意義?為什么會得到不同的結果?

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號