JavaRush/Java Blog/Random EN/Problem with Integer.parseInt(String s) method
nanoezhik
Level 41

Problem with Integer.parseInt(String s) method

Published in the Random EN group
members
Dear forum users! Maybe some of you have encountered a problem using the method: Integer.parseInt(String s). Problem with the Integer.parseInt(String s) method - 1The problem is this: the method physically on my computer doesn't want to convert some strings to numbers. We have the string "1568", the method throws an error:
Exception in thread "main" java.lang.NumberFormatException: For input string: "1568"
The last time I encountered such a problem was when solving the problem level19.lesson05.task03. I read a line from a file and split it into an array of strings using the method .split(" "), and then convert the strings into numbers (if this is possible, if not, I catch the exception and do nothing), the first number in the line is ignored for some reason. Has anyone encountered this, or who knows what the problem is? ps The compiler on the site skips my code!
Comments
  • Popular
  • New
  • Old
You must be signed in to leave a comment
This page doesn't have any comments yet