© Doug Winnie 2021
D. WinnieEssential Java for AP CompScihttps://doi.org/10.1007/978-1-4842-6183-5_60

60. An All-Star Cast, Featuring Null

Doug Winnie1  
(1)
Mission Hills, KS, USA
 

With most of the program finished, we only have a few more things to wrap up. We have a party system built into our program, but we need a way to work with that collection of players in our Party class and work with them as a group in our main program. Along the way, we will encounter a few other items we need to accommodate for in our program.

Let’s first take a look at our existing program in the Main class:
public class Main {
    public static void main(String[] args) {
        Party myParty = new Party();
        myParty.addTank(new Fighter("Sentri"));
        myParty.addRange(new ...

Get Essential Java for AP CompSci: From Programming to Computer Science 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.