簡體   English   中英

線程“main”中的異常 java.lang.NumberFormatException:對於輸入字符串:“8/3/2012”

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

為什么我收到這些錯誤消息。

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.

如果您嘗試將字符串轉換為數字。 在上述情況下,我認為您的字符串是“8/3/2012”。 要轉換為任何數字,您不能有數字以外的任何字符,或者如果您想要小數,則可以有 double。

這看起來像一個日期,請瀏覽 Date 類,看看如何將其轉換為日期。

日期 8/3/2012 不是正確的數字類型。 檢查將其解析為 Double 的代碼行。

從java文檔,

拋出以指示應用程序已嘗試將字符串轉換為數字類型之一,但該字符串沒有適當的格式。

參考這里

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM