Question: java question Which pair of the exceptions are the most appropriate to be used in the catch blocks of the following program? public class HelloWorld

java question
Which pair of the exceptions are the most appropriate to be used in the catch blocks of the following program? public class HelloWorld { public static void main(String args[]) { Scanner in = new Scanner(System.in); try { int k = in.nextInt(); String s = "JAVAisnotfun"; System.out.println(s.charAt(k)); } catch ex) { } catch { ex) } finally { Select one: a.Input MismatchException and ClassCastException b.InputMismatchException and StringIndexOutOfBoundsException c. There is no risk of exception d.NullPointerException and StringIndexOutOfBoundsException e.ArithmeticException and ClassCastException
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
