Hopefully a very simple request, but that left me scratching my head.
I have a string that is just one integer, and I am trying to then get that integer as an int. This at first glance should not be a problem.
This always fails with a NumberFormatException error. I canβt let my life determine that because of this, some ideas are very appreciated. I did not code much in Java (recently), so I would just forget something critical and what not.
Exception in thread "main" java.lang.NumberFormatException: For input string: "1" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) at java.lang.Integer.parseInt(Integer.java:481) at java.lang.Integer.parseInt(Integer.java:514) at udp.UDPServer.processMessage(UDPServer.java:85) at udp.UDPServer.run(UDPServer.java:52) at udp.UDPServer.main(UDPServer.java:156)
source share