public abstract class Product() { public void methodA() { // do something } // for subclass public abstract void methodB(); } public class ConcreteProduct1 extends Product() { public void methodB(){ // do something } } public class ConcreteProduct2 extends Product() { public void methodB(){ // do something } } public abstract class Creator{ public abstract <T extends Product> T createProduct(Class <T> c); } public class ConcreteCreator extends Creator { public <T extends Product> T createProduct(Class<T> c){ Product product = null; try { product = (Product) Class.forName(c.getName()).newInstance(); } catch (Exception e) { //TODO: handle exception } return (T) product; } }