added throw and catch exceptions
Revert "added throw and catch exceptions"

This reverts commit 1d963835400a93c33f8a8c81c2d94ebf19a09178.
added throw and catch IndexOutOfBoundsException