我得到NumberFormatException爲字符串9999999990但不是當我使用1111111110 當我通過該字符串調用Integer.parseInt時。 讓我知道什麼是錯的。Integer.parseInt(「9999999990」);
String str="9999999990";
int f = Integer.parseInt("2147483647");// No Exception here
int x =Integer.parseInt(str); // Exception is thrown here
是的,因爲int的最大值爲 – StackFlowed 2014-09-10 17:24:07
[Integer.MAX_VALUE](http://docs.oracle.com/javase/7/docs/api/java/lang/Integer.html#MAX_VALUE) – 2014-09-10 17:25:47
Java數據類型概述:http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html – MrTux 2014-09-10 17:26:43