, getClass(). newInstance(), (, InstantationException IllegalAccessException).
- , ( ) , getNewInstance(), .
.
Thing foo() {
Thing th = getNewInstance();
return th;
}
Thing getNewInstance() {
return getClass().newInstance();
}
getNewInstance() , , , .
Thing getNewInstance() {
return new BigThing(10, ThingSize.METRES);
}