019-002-003
Exception Handling: Number Format Error
Hard
Problem Description
NumberFormatException
Integer.parseInt() throws this exception when the string cannot be converted to a number.
.Test Cases
※ Output examples follow programming industry standards
Input:
42
Expected Output:
Number: 42
Input:
123
Expected Output:
Number: 123
Input:
abc
Expected Output:
Error: Invalid number format
Input:
12.5
Expected Output:
Error: Invalid number format
Input:
0
Expected Output:
Number: 0
❌ Some tests failed
Your Solution
Current Mode:● My Code
99
1
2
3
4
5
6
7
8
9
10
›
⌄
⌄
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// Write your code here
sc.close();
}
}
0 B / 5 MB
You have 9 free executions remaining
