java – Integer.parseInt(“9999999990”);
发布时间:2020-12-15 05:12:06 所属栏目:Java 来源:网络整理
导读:参见英文答案 Unexpected NumberFormatException while parsing a hex string to an int value????????????????????????????????????5个 我得到字符串9999999990的NumberFormatException但不是我使用2222211110时 当我通过该字符串调用Integer.parseInt时.
参见英文答案 >
Unexpected NumberFormatException while parsing a hex string to an int value????????????????????????????????????5个
我得到字符串9999999990的NumberFormatException但不是我使用2222211110时 当我通过该字符串调用Integer.parseInt时. 让我知道什么是错的. String str="9999999990"; int f = Integer.parseInt("2147483647");// No Exception here int x =Integer.parseInt(str); // Exception is thrown here 解决方法
当解析它不能表示为int时,
Integer.parseInt 将抛出异常.第一个例子是近100亿,大于最大可能的int,这个数字略高于20亿.
Integer.parseInt(String)委托给
(强调我的) 如果需要解析它,可以使用 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |