This preview shows page 1. Sign up to view the full content.
Unformatted text preview: Integer can be added to b . An attempt to add an object of a class that is not In-teger or a subclass of Integer will be flagged as illegal, and the program wont compile. You can put any class in place of Integer . The ability to constrain ArrayList s in this fashion simplifies some coding and provides more type safety. By using a constrained ArrayList , you can reduce the chance of making an error by adding something to an ArrayList that does not belong there. Constrain you ArrayList s where possible....
View Full Document
This note was uploaded on 07/07/2008 for the course CS 101 taught by Professor Gries during the Spring '08 term at Cornell University (Engineering School).
- Spring '08