Skip to content

Instantly share code, notes, and snippets.

@secondspass
Last active October 22, 2019 00:36
Show Gist options
  • Save secondspass/05b218825fe55a712b50a8c50fa01fd7 to your computer and use it in GitHub Desktop.
Save secondspass/05b218825fe55a712b50a8c50fa01fd7 to your computer and use it in GitHub Desktop.
import java.util.*;
class FoodFactory extends Solution {
}
class Food extends Solution {
}
class Solution {
FoodFactory ff = new FoodFactory();
Food fastfood = FoodFactory.getFood("Fast Food");
Food orange = FoodFactory.getFood("Orange");
System.out.println("the food is "+fastfood.getClass().getName());
System.out.println("the food is "+orange.getClass().getName());
// The output should be:
// the food is Fast Food
// the food is Orange
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment