Why am i seeing "numberformatexception" in java?

Example:

int num = Integer.parseInt("NaN");
This error is raised when attempting to convert a string that doesn't have an appropriate format to a number.

Solution:

try {
    int num = Integer.parseInt("123");
} catch (NumberFormatException e) {
    e.printStackTrace();
}

Beginner's Guide to Java