class CustomException extends Exception { public CustomException(String message) { super(message); } } public class Pr3b { public static void main(String args[]) { try { int age = -20; if (age < 0) { throw new CustomException("Age can't be negtive."); } System.out.println("Aeg:" + age); } catch (CustomException e) { System.err.println("Error:" + e.getMessage()); } } }