简体   繁体   English

线程“main”中的异常 java.lang.NumberFormatException:对于输入字符串:“8/3/2012”

[英]Exception in thread "main" java.lang.NumberFormatException: For input string: "8/3/2012"

Why I'm getting these error message.为什么我收到这些错误消息。

Exception in thread "main" java.lang.NumberFormatException: For input string: "8/3/2012"
    at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1222)
    at java.lang.Double.parseDouble(Double.java:510)
    at com.exel.raf.seeit.ExecuteImport.excelDtToString(ExecuteImport.java:713)
    at com.exel.raf.seeit.ExecuteImport.generateItemHistorySql(ExecuteImport.java:649)
    at com.exel.raf.seeit.ExecuteImport.execute(ExecuteImport.java:56)
    at com.exel.raf.seeit.ExecuteImport.main(ExecuteImport.java:38)
    Process exited with exit code 1.

If you are trying to convert String to Number.如果您尝试将字符串转换为数字。 In the above case I think your String is "8/3/2012".在上述情况下,我认为您的字符串是“8/3/2012”。 For converting to any number, you must not have any characters other than numbers or you can have double if you want decimals.要转换为任何数字,您不能有数字以外的任何字符,或者如果您想要小数,则可以有 double。

This looks like a date, please explore the Date class and see how you can convert it to a date.这看起来像一个日期,请浏览 Date 类,看看如何将其转换为日期。

Date 8/3/2012 is not proper numeric type.日期 8/3/2012 不是正确的数字类型。 Check the line of code where you are parsing it to Double.检查将其解析为 Double 的代码行。

From the java docs,从java文档,

Thrown to indicate that the application has attempted to convert a string to one of the numeric types, but that the string does not have the appropriate format.抛出以指示应用程序已尝试将字符串转换为数字类型之一,但该字符串没有适当的格式。

refer here 参考这里

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 java-线程“ main”中的异常java.lang.NumberFormatException:对于输入字符串:“”位于 - java - Exception in thread “main” java.lang.NumberFormatException: For input string: “” at 线程“ main”中的异常java.lang.NumberFormatException:对于输入字符串:Java中的“” - Exception in thread “main” java.lang.NumberFormatException: For input string: “” in Java 线程“ main”中的异常java.lang.NumberFormatException:对于输入字符串:“ 0.06” - Exception in thread “main” java.lang.NumberFormatException: For input string: “0.06” 线程“ main”中的异常java.lang.NumberFormatException:对于输入字符串:“” - Exception in thread “main” java.lang.NumberFormatException: For input string: “” 线程“main”中的异常 java.lang.NumberFormatException:对于输入字符串:“0.353” - Exception in thread “main” java.lang.NumberFormatException: For input string: “0.353” 线程“ main”中的异常java.lang.NumberFormatException:对于输入字符串:“; - Exception in thread “main” java.lang.NumberFormatException: For input string: "; 线程“ main”中的异常java.lang.NumberFormatException:对于输入字符串:“ 33” - Exception in thread “main” java.lang.NumberFormatException: For input string: “33” 线程“ main”中的异常java.lang.NumberFormatException:对于输入字符串:“” - Exception in thread “main” java.lang.NumberFormatException: For input string: “ ” 错误:线程“ main”中的异常java.lang.NumberFormatException:对于输入字符串:“” - Error : Exception in thread “main” java.lang.NumberFormatException: For input string: “” 线程“主”中的异常java.lang.NumberFormatException:用于输入字符串号 - Exception in thread “main” java.lang.NumberFormatException: For input string number
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM