// Java class Problem extends Exception{ Problem(){super();} Problem(String s) {super(s);} } public class CatchOrSpecifyDemo0 { public static void main(String[] args){ explosion(); // Compile-time error: // unreported exception Problem; // must be caught or declared to be thrown } static void explosion() throws Problem { System.out.println("Explosion!"); throw new Problem("We have an explosive problem"); } }