-
What is the output of below snippet?
Obj[] names = new String[10];
name[0] = new Integer(0);
-
- ArrayIndexOutOfBoundsException
- Compilation Error
- Code runs successfully
- ArrayStoreException
- None of these
Correct Option: D
ArrayIndexOutOfBoundsException comes when code tries to access an invalid index for a given array. ArrayStoreException comes when you have stored an element of type other than the type of array.