java.lang.NumberFormatException: For input string: "1 "

Searched on Google with the first line of a JAVA stack trace?

We can recommend more relevant solutions and speed up debugging when you paste your entire stack trace with the exception message. Try a sample exception.

Recommended solutions based on your search

Samebug tips

,

You try to parse a String that contains non-numeric characters to an int. The string must contain decimal characters only, optionally beginning with a + or - sign.

,

Can occur when you try to convert a String to a numeric value but the String is not well formatted for the conversion.

Solutions on the web

via Oracle Community by 807594, 1 year ago
For input string: "1 "
via Stack Overflow by BornForJava
, 2 years ago
via Stack Overflow by user3569895
, 2 years ago
via Stack Overflow by JJ Thomson
, 1 year ago
java.lang.NumberFormatException: For input string: "1 "
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Integer.parseInt(Integer.java:435)
at java.lang.Integer.parseInt(Integer.java:476)
at undefined.StarWars.main(StarWars.java:245)

Users with the same issue

4 times, 2 days ago
Once, 3 days ago
4 times, 1 week ago
16 times, 1 week ago
6 times, 1 week ago

Write tip

Know the solutions? Share your knowledge to help other developers to debug faster.