Java – NumberFormatException

NumberFormatException: Thrown when an attempt is made to convert a string into a number, but the string does not have an appropriate format.
Example:

String str = "abc";
try {
int number = Integer.parseInt(str);
} catch (NumberFormatException e) {
System.out.println("Caught NumberFormatException: " + e.getMessage());
}

No images available.