exception/java-comparison/CatchOrSpecifyDemo2.java - A Java program - main specifies Problem. | Lecture 9 - slide 27 : 30 Program 3 |
// Java class Problem extends Exception{ Problem(){super();} Problem(String s) {super(s);} } public class CatchOrSpecifyDemo2 { public static void main(String[] args) throws Problem { explosion(); } static void explosion() throws Problem{ System.out.println("Explosion!"); throw new Problem("We have an explosive problem"); } }