Run ❯
Get your
own Java
server
❯
Run Code
Ctrl+Alt+R
Change Orientation
Ctrl+Alt+O
Change Theme
Ctrl+Alt+D
Go to Spaces
Ctrl+Alt+P
public class Main { public static void main(String[] args) { try { int[] numbers = {1, 2, 3}; System.out.println(numbers[10]); // ArrayIndexOutOfBoundsException int result = 10 / 0; // ArithmeticException } catch (ArrayIndexOutOfBoundsException e) { System.out.println("Array index does not exist."); } catch (ArithmeticException e) { System.out.println("Cannot divide by zero."); } catch (Exception e) { System.out.println("Something else went wrong."); } } }
Array index does not exist.