package example6_1_ExceptionHandling; import javax.swing.JOptionPane; public class ExceptionHandlingExample { public static void main(String[] args) { String numberString = JOptionPane.showInputDialog("Please enter a number: "); double number = 0; try { number = Double.parseDouble(numberString); //helperMethod(); // CAUSES COMPILE ERROR. //} catch(Exception e) { } catch(NumberFormatException e) { System.out.println("Wrong value entered, couldn't parse."); } System.out.println("You entered: "+number); try { helperMethod(); } catch(Exception e) { System.out.println("Caught an exception."); } System.out.println("Hello!"); } public static void helperMethod() throws Exception { throw new Exception("Something's wrong."); } }