Header Ads Widget

Ticker

6/recent/ticker-posts

java.lang.numberformatexception for input string null - Cause and Solution

The java.lang.NumberFormatException comes when you try to parse a non-numeric String to a Number like Short, Integer, Float, Double etc. For example, if you try to convert . "null" to an integer then you will get NumberFormatException. The error "Exception in thread "main" java.lang.NumberFormatException: For input string: "null" is specifically saying that the String you receive for parsing is not numeric and it's true, "null" is not numeric. Many Java methods which convert String to numeric type like Integer.parseInt() which convert String to int, Double.parseDoble() which convert String to double, and Long.parseLong() which convert String to long throws NumberFormatException to inform that the input String is not numeric.
Read more »

Yorum Gönder

0 Yorumlar