This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
An ArrayOutOfBoundsException does not indicate an invalid password - it means you are trying to read outside the bounds of your array. As I told you in your previous post, change
and you will no longer get the exception
Joined: Aug 05, 2005
Actually, thinking about it, an ArrayOutOfBoundsException would indicate an invalid password, because you would have checked the password against all the Person objects in your array and not found a match - it is just not the best way to do it. Of course, if this is the case, there is no need to return to your try statement, because you will have already checked all the possible passwords.
Joanne is quite right; you are setting up the "for" loop wrongly, and the format for "for" loops is a standard part of beginners' Java. In my opinion catching an ArrayIndexOutOfBoundsException means minus 1 mark automatically!
Welcome to the Ranch, Chinmay S Bedarkar. The "continue" is redundant; the loop will repeat after the catch regardless.