We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
I think this should be the point of what we should learn in this problem. Instead of just using "pizza" and "cake" for comparison.
if (order.equals(Pizza.class.getName().toLowerCase())){
return new Pizza();
}
if (order.equals(Cake.class.getName().toLowerCase())){
return new Cake();
}
return null;
Cookie support is required to access HackerRank
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 think this should be the point of what we should learn in this problem. Instead of just using "pizza" and "cake" for comparison.