A NumberFormatException occurs in Java code when a programmer tries to convert a String into a number and the conversion fails.
A NumberFormatException
is thrown to indicate that an attempt to parse numeric information in a string has failed. NumberFormatException
is a subclass of the RuntimeException
class. The number might be int
, float
, or any of Java's numeric values.