Pergunta de entrevista da empresa American Express

Implement exception handling if you had to iterate through an array.

Respostas da entrevista

Sigiloso

23 de mar. de 2018

1) If null, throw exception 2) If size == 0, throw exception

Sigiloso

3 de mai. de 2018

If an we request an index that is negative or greater than or equal to size of the array then an ArrayIndexOutOfBound exception is thrown. We can implement this exception while iterating through the array.