Java Factory Pattern

Sort by

recency

|

159 Discussions

|

  • + 0 comments

    Here is Java factory pattern solution - https://programmingoneonone.com/hackerrank-java-factory-pattern-problem-solution.html

  • + 0 comments

    //write your code here if(order.equals("cake")){ return new Cake(); }else if(order.equals("pizza")){ return new Pizza(); } return null;

    Just by adding above it'll work with Java8

  • + 0 comments

    //write your code here if(order.equals("cake")){ return new Cake(); }else if(order.equals("pizza")){ return new Pizza(); } return null;

    Just by adding above it'll work with Java8

  • + 0 comments

    Many homeowners turn to fast home sale services during stressful or complex life events—such as foreclosure, divorce, bankruptcy, job loss, or the passing of a loved one. These situations often require urgent decision-making and financial relief. Traditional real estate processes can take too long and involve emotionally draining steps like showings, inspections, and negotiations Sell My House Fast Tennessee. Fast home-buying companies step in as a reliable, low-stress alternative, offering quick resolutions and the ability to move on without delays or drawn-out procedures.

  • + 1 comment
    class FoodFactory {
    		public Food getFood(String order) {
                Cake c = new Cake();
               Pizza p = new Pizza();
            
              if(order.equals("cake")){
                return c;
              }
              else{
                return p;
              }
              
    
    }