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

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

不能理解,為什么three在下一行的值會變成上一行的值

package com.wolike;


public class 試題8賦值運算符 {

public static void main(String[] args){

int one=10;

int two=20;

int three=30;

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

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

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

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

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

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

}


}

最后輸出的是:

three=one+two==>30

three+=one==>40

three*=one==>300

three/=one==>3

three-=one==>20

three%=one==>0


正在回答

4 回答

你這three的賦值是30,源代碼中是0,另外你的代碼沒有將three重新賦值,所以three始終是30,并沒有像你說的那樣“下一行的值會變成上一行的值”。

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

因為你發的代碼沒有將three重新賦值,所以你的運算結果永遠是用one和two這兩個變量進行計算,計算結果肯定跟任務中要求的結果不一樣。

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

多去看看2-4的課。就能理解

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

不好意思,發錯了


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

舉報

0/150
提交
取消

不能理解,為什么three在下一行的值會變成上一行的值

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

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

幫助反饋 APP下載

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

公眾號

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