I\'m a beginner to Java programming and I encounter the following exception:
Exception in thread \"main\" java.lang.NumberFormatException: null
at ja
This exception occurs if you try to convert a string to a number, where the string does not actually contain a number.
Example:
Integer.valueOf("10").intValue();
works, but Integer.valueOf("abcd").intValue()
throws out the NumberFormatException
.
Check your input file and make sure you're actually having a number there.
Line by Line debugger would be very useful here. Also use the good old System.out.println
to see the value in id
.
That exception means that when you are executing this line of code
id1 = Integer.valueOf(id).intValue();
the value you are trying to convert into an integer (id
), isn't a number.
You need to double check your input file's format.