This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Cannot throw exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Cannot throw exception" Watch "Cannot throw exception" New topic
Author

Cannot throw exception

Dominic Griffin
Greenhorn

Joined: Jun 10, 2009
Posts: 16






pete stein
Bartender

Joined: Feb 23, 2007
Posts: 1561
You seem to be testing if the array's length is < 0 (impossible) or > 100, not whether the numbers it contains are out of bounds.
Dominic Griffin
Greenhorn

Joined: Jun 10, 2009
Posts: 16
How do I test whether the numbers are out of bounds
pete stein
Bartender

Joined: Feb 23, 2007
Posts: 1561
How do I test whether the numbers are out of bounds

By iterating through the array with a for-loop (as you already are doing), and testing each array element to see if it is in bounds or not.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Cannot throw exception
 
Similar Threads
Compile error
TestScores
TestScores
Noob Problem
Array returning last value entered