?int one = 10 ;? ? ? ? int two = 20 ;? ? ? ? int three = 0 ;? ? ? ? three=one+two;? ? ? ? System.out.println("three = one + two ==> "+three);? ? ? ? three+=one;?請問一下java為什么不需要像C語言那樣在需要調(diào)用結(jié)果的地方輸入%d什么的嗎 three=one+two=>%d,three 像上面那樣怎么知道three放哪兒
1 回答

Caballarii
TA貢獻1123條經(jīng)驗 獲得超629個贊
"three = one + two ==> "是字符串,three是int,字符串加int會將int強制轉(zhuǎn)化成字符串然后拼接,輸出一個完整的字符串。
拋棄C語言的習慣吧,不要想太多,Java就是讓你不要想太多的
System.out.println就是輸出字符串的,先算括號里的表達式
點擊展開后面1條
添加回答
舉報
0/150
提交
取消