Java – NumberFormatException

NumberFormatException: Thrown when an attempt to convert a string to a numeric type fails.
Example:

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

No images available.