A

Admin • 825.56K Points
Coach

Q. What will the code throw?
String[] arr = new String[-5];

  • (A) IndexOutOfBoundsException
  • (B) IllegalArgumentException
  • (C) NegativeArraySizeException
  • (D) ArrayIndexOutOfBoundsException

Explanation by: Admin
Trying to declare an array with a negative size throws NegativeArraySizeException.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.