I came across this code in an exercise for declaring an abstract class:
import java.util.ArrayList;
public abstract class Box {
public abstract void add(Item item);
public void add(ArrayList<Item> items) {
for (Item item : items) {
Box.this.add(item);
}
}
public abstract boolean isInBox(Item item);
}
I am not able to understand what the add(ArrayList<Item> item) method does. I get it that it loops through an ArrayList called items but what does Box.this.add(item) do?
Can someone clarify this?