4
answers
0
watching
364
views
28 Jul 2018
18. What kind of exception would be caught below? public class Test public static void main(String[] args) try String[] s = new String[3]; S[1] = "Hello"; s [2] = "World"; for (int i = 0; i <= s.length - 1; i++) System.out.print (s[i].length()); catch (Exception e) System.out.println(e); (A) NullPointerException (B) ArrayIndexOutOfBoundsException (C) Input MismatchException (D) NumberFormatException (E) No exception would be caught.
18. What kind of exception would be caught below? public class Test public static void main(String[] args) try String[] s = new String[3]; S[1] = "Hello"; s [2] = "World"; for (int i = 0; i <= s.length - 1; i++) System.out.print (s[i].length()); catch (Exception e) System.out.println(e); (A) NullPointerException (B) ArrayIndexOutOfBoundsException (C) Input MismatchException (D) NumberFormatException (E) No exception would be caught.
29 Jun 2023
Jean KeelingLv2
30 Jul 2018
Already have an account? Log in