The Class BagOfStrings So Far

In this lesson, we will collect the constructor and method definitions into a class and test it.

The class and a client

The following program shows the definition of the class BagOfStrings at this point in its development. It contains only the data fields, constructors, and core methods that we have seen earlier. Before we continue the implementation of this class, we will test the class using the method main in the class BagDemo1, which is also in the code given below. Click the RUN button.

Get hands-on with 1400+ tech skills courses.