Answers for "is try and catch block catching only one exception"

0

is try and catch block catching only one exception

class Main {
  public static void main(String[] args) {
    try {
      int array[] = new int[10];
      array[10] = 30 / 0;
    } catch (ArithmeticException e) {
      System.out.println(e.getMessage());
    } catch (ArrayIndexOutOfBoundsException e) {
      System.out.println(e.getMessage());
    } 
  }
}
Posted by: Guest on January-30-2021

Code answers related to "is try and catch block catching only one exception"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language