關(guān)于賦值運(yùn)算覆蓋之前的值問題
這是我的代碼,我是直接讓three的值打印出來,沒有像標(biāo)準(zhǔn)答案一樣先定義再打印也會(huì)覆蓋之前three的值嗎?因?yàn)槲矣悬c(diǎn)python的基礎(chǔ),這個(gè)和python差的有點(diǎn)遠(yuǎn),所以不大好接受。
public static void main(String[] args) {
????????int one = 10 ;
? ? ? ? int two = 20 ;
? ? ? ? int three = 0 ;
????????System.out.println(three=one+two);
? ? ? ? System.out.println(three += one);
? ? ? ? System.out.println(three -= one);
? ? ? ? System.out.println(three *= one);
? ? ? ? System.out.println(three /= one);
? ? ? ? System.out.println(three %= one);
2018-09-03
30
40
30
300
30
0
答案