Exception demo

Run Settings
LanguageJava
Language Version
Run Command
class Main { public static void main(String[] args) { int[] mArr = new int[2]; try { //Something dangerous mArr[3] = 5; } catch (ArrayIndexOutOfBoundsException e){ System.out.println("Did something baaaad!"); // Do more things to gracefully handle the error } System.out.println("But I can still continue the program"); try { //Something dangerous mArr[3] = 5; } catch (ArrayIndexOutOfBoundsException e){ throw new RuntimeException("Throwing another exception here! Which doesn't get caught"); } System.out.println("Program never gets here "); } }
Editor Settings
Theme
Key bindings
Full width
Lines