Just looking for a clear definition of the following:
When you include ArrayList<Product>
in the class declaration, and product being another class that holds some instance variables. When using the code shown below, Is the ArrayList
initialized on creation of the object?
For example :
public class Basket extends ArrayList<Product> implements Serializable
{
private int theOrderNum = 0; // Order number
public Basket()
{
theOrderNum = 0;
}
}
If I create an instance of the new class :
Basket test = new Basket();
Would that create an array list on the object being created? In order to access the ArrayList
inside the object, could I use this.add(foo);
?