Question: How to I fix this error? Exception in thread main java.lang.NumberFormatException: For input string: at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) at java.lang.Integer.parseInt(Integer.java:569) at java.lang.Integer.parseInt(Integer.java:615) at refrigerator.Refrigerator.main(Refrigerator.java:229) /Users/home/Library/Caches/NetBeans/8.2/executor-snippets/run.xml:53:
How to I fix this error?
Exception in thread "main" java.lang.NumberFormatException: For input string: " "
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:569)
at java.lang.Integer.parseInt(Integer.java:615)
at refrigerator.Refrigerator.main(Refrigerator.java:229)
/Users/home/Library/Caches/NetBeans/8.2/executor-snippets/run.xml:53: Java returned: 1

226 227 228 229 230 231 232 if(line.charAt(0)=='I') { } int item = Integer.parseInt(line.charAt(2)+""); int numRef = Integer.parseInt(line.charAt(4)+""); listRefs [numRef].insert_item(item); output = "Attempt to add "+item+" into refrigerator #"+numRef;
Step by Step Solution
3.59 Rating (153 Votes )
There are 3 Steps involved in it
Based on the error message it seems like youre trying to parse an empty string a string containing only whitespace as an integer Here are a few potent... View full answer
Get step-by-step solutions from verified subject matter experts
