You are viewing a single comment's thread. Return to all comments →
I opted this way, to avoid a hard coded solution:
if (Pizza.class.getName().equalsIgnoreCase(order)){ return new Pizza(); } if (Cake.class.getName().equalsIgnoreCase(order)){ return new Cake(); } return null;
Seems like cookies are disabled on this browser, please enable them to open this website
Java Factory Pattern
You are viewing a single comment's thread. Return to all comments →
I opted this way, to avoid a hard coded solution: