Home Segments Top Top Previous Next

851: Mainline

Testing the index in the getMovie method, defined in Segment 850, is an example of defensive programming. Although it might seem unlikely that an out-of-bounds argument could be supplied, you should be sure that nothing horrible happens if the argument is, in fact, out of bounds.