當我嘗試繁殖的charAt我收到了「大」數:我可以在Java中增加charAt嗎?
String s = "25999993654";
System.out.println(s.charAt(0)+s.charAt(1));
結果:103
但是,當我想收到只有一個號碼沒關係。
在Java文檔:
the character at the specified index of this string. The first character is at index 0.
所以我需要解釋或解決方案(我想,我應該將字符串轉換爲int,但在我看來這是unnesessary工作)
你不是乘以那裏,您要添加。另外,你所說的輸出是「100」實際上是「103」。 – 2012-07-27 11:18:49