If I have an abstract class like this:
public abstract class Item
{
private Integer value;
public Item()
{
value=new Integer(0);
}
You can place an abstract method so that the implementing class can determine how to construct the new object.
public abstract T constructT();
and instead of calling
T t = new T()
you would call
T t = constructT();
On your implementing call it would be created as:
new Box() {
public Integer constructT(){ return new Integer(); }
}