当我尝试繁殖的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