NumberFormatException

NumberFormatException is the child class of IllegalException which is the child class of RunTimeException, Hence it is an unchecked Exception.

NumberFormatException is explicitly raised either by the programmer or API developer to indicate that we are trying to convert a String to a number and the String is not formatted properly.

public class NumberFormat {
    public static void main(String[] args) {
        int i = Integer.parseInt("TWO");
    }
}
NumberFormatException

Similar Java Tutorials

Leave a Comment