You are viewing a single comment's thread. Return to all comments →
If this is java Factory then we must use Java Factory:
Food demo = null; try{ order=order.substring(0, 1).toUpperCase() + order.substring(1); Class clazz = Class.forName(order); demo = (Food) clazz.newInstance(); }catch(Exception e){
}
return demo;
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 →
If this is java Factory then we must use Java Factory:
Food demo = null; try{ order=order.substring(0, 1).toUpperCase() + order.substring(1); Class clazz = Class.forName(order); demo = (Food) clazz.newInstance(); }catch(Exception e){
}
return demo;