019-002-004
Exception Classes: Custom Exception
Hard
Problem Description
Custom Exception Classes
Create custom exceptions by extending Exception class. Enables business logic-specific exception handling.
.Test Cases
※ Output examples follow programming industry standards
Input:
25
Expected Output:
Valid age: 25
Input:
-5
Expected Output:
Error: Invalid age - must be between 0 and 150
Input:
0
Expected Output:
Valid age: 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
