Check out example codes for "java check if string is number". It will help you in understanding the concepts better.

Code Example 1

try {
    int n = Integer.parseInt(str);
} catch (NumberFormatException e) {
    // str is not a number
}

Learn ReactJs, React Native from akashmittal.com