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


Samebug tips3

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.


4 weeks ago

Java does not handle IPv6 nameservers before 1.8.0_60. Upgrade to the latest JVM.


5 months ago

Solutions on the web4043

Solution icon of stackoverflow
For input string: "q"

Solution icon of stackoverflow
For input string: "q"

Solution icon of stackoverflow
via Stack Overflow by Shantanu
, 1 year ago
For input string: "string"

Solution icon of stackoverflow
via Stack Overflow by Pejman Tehrani
, 1 year ago
For input string: "java.util.Scanner[delimiters=\p{javaWhitespace}+][position=0][match valid=false][need input=false][source closed=false][skipped=false][group separator=\ ][decimal separator=\,][positive prefix=][negative prefix=\Q-\E][positive suffix=][negative suffix=][NaN string=\Q?\E][infinity string=\Q∞\E]"

Solution icon of web
For input string: ""java.lang.NumberFormatException: For input string: ""

Solution icon of googlegroups
via Google Groups by DS, 1 year ago
For input string: " ?@? C7?XC; @@ ?@ z(@ @ ??@ .?@ 8?@ ??@ Q`@ ?@ g?@ U?@ 0?@ ?C??@C6 p@ ?H@ SP@ Q@ @ ?@ ?h@ ??@ J?@ ??@ Y?@ ?8@?hCF, CA??@ ??@?CI?@?@@ ??@ U @ ?8@ =`CF?X@ ??CG??@S?@ ??@ ??@ ??@ i8@ ??@ X`@ wP@ "xCF?@ ?h@ ?@?8@ ?pC6?@ 8U @ ??@ x@"

Solution icon of coderanch
via Coderanch by Elinor Chang, 9 months ago
For input string: "0.0000000000null"

Solution icon of coderanch
via Coderanch by Henry Wong, 1 year ago
For input string: ""

Solution icon of coderanch
via Coderanch by Jherald Lacambra, 1 year ago
For input string: " "

Solution icon of coderanch
via Coderanch by Sarah Rainier, 1 year ago
For input string: "jjss"

Stack trace

java.lang.NumberFormatException: For input string: "q"
	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
	at java.lang.Integer.parseInt(Integer.java:580)
	at java.lang.Integer.parseInt(Integer.java:615)
	at GuessGame.main(GuessGame.java:18)

Write tip

You have a different solution? A short tip here would help you and many other users who saw this issue last week.

Users with the same issue

2 times, 6 days ago
Once, 1 week ago
Once, 2 weeks ago
Once, 3 weeks ago
Once, 4 weeks ago
254 more bugmates