The Class BagOfStrings So Far
Learn how the BagOfStrings class is constructed using array-based data structures for efficient collection management. Understand the use of constructors, methods like isFull, and how to test the class with sample data. Explore the role of static methods in manipulating array contents and how objects passed as arguments can be modified within methods.
We'll cover the following...
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.
After running the previous program, you should get the following output:
Adding to an empty bag: A, A, B, A, C, A The bag contains A A B A C A This bag is not full. Adding to an empty bag: A, B, A, C, B, C, D The bag contains A B A...