What will happen if you try to access an element with an index greater than the size of the ArrayList?

Last Updated :
Discuss
Comments

What will happen if you try to access an element with an index greater than the size of the ArrayList?


It throws an ArrayIndexOutOfBoundsException

It throws a NoSuchElementException

It returns null

It throws an IndexOutOfBoundsException

Share your thoughts in the comments