關于賦值運算覆蓋之前的值問題
這是我的代碼,我是直接讓three的值打印出來,沒有像標準答案一樣先定義再打印也會覆蓋之前three的值嗎?因為我有點python的基礎,這個和python差的有點遠,所以不大好接受。
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
答案