9.8 Programming Activity 2: Working with the ArrayList Class
In this activity, you will work with an ArrayList object. Specifically, you will write the code to perform the following operations:
Fill the ArrayList object with Auto elements.
Print the Auto elements contained in the ArrayList object.
Set the model instance variable of every Auto element in the ArrayList object to a specified model.
Find the maximum number of miles of all Auto elements contained in the ArrayList object.
Count the number of Auto elements in the ArrayList with a specified model.
Table 9.6 provides the API for the Auto class.
TABLE 9.6 Constructors and Some Methods of the Auto Class
Auto Class Constructor Summary |
|
---|---|
Auto( )
|
Get Java Illuminated, 5th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.