java 对于输入字符串:错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/41815499/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
For input string: Error
提问by Jason Smith
I have a csv file, which I am trying to export into database using java. I have a Builder column which I have labeled as String but my snippet blows up I do not know why this is happening and why I have the Integer.parseInt being displayed in the error even though I have the column labeled as a string. I am a novice in Java so would appreciate any assistance.
我有一个 csv 文件,我正在尝试使用 java 将其导出到数据库中。我有一个 Builder 列,我已将其标记为 String 但我的代码段炸毁了我不知道为什么会发生这种情况以及为什么我在错误中显示 Integer.parseInt 即使我将该列标记为字符串。我是 Java 新手,因此非常感谢您的帮助。
java.lang.NumberFormatException: For input string: "McKenzie Homes"
at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
回答by Fin Dev
Somewhere in your application Integer.parseInt() is being called. Might want to check where in the app it is being executed, and make sure that it does not get called on Strings.
在您的应用程序中的某个地方正在调用 Integer.parseInt()。可能想要检查它在应用程序中的执行位置,并确保它不会在字符串上被调用。