An Unallocated Array
Understand how to properly allocate arrays in Java to avoid initialization errors. Explore common mistakes like unallocated arrays and learn debugging techniques to improve your Java programs.
We'll cover the following...
We'll cover the following...
An early version of the class BagOfStrings
The previous chapter used an array of strings in the definition of the class BagOfStrings. We learned to focus on a core group of methods when beginning the definition of a new class, instead of tackling the entire class at once. Even so, our development of this core group likely would progress in smaller steps than that chapter describes. For example, imagine that we have begun writing the class in a simple manner by defining only two data fields—bag and ...