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");
}
}
Similar Java Tutorials
- Odd Even in Java
- Fibonacci Series Java
- Method to print exception information in Java
- Exception Handling by Using try-catch in Java
- Checked Exception vs Unchecked Exception
- Exception Hierarchy in Java
- Java Exception Handling Interview Questions
- final finally finalize in java
- User Defined Exception in Java
- Exception Handling Keyword in Java
- throw throws in Java
- try with multiple catch block in Java