abstract class Fruit{
}
class Apple extends Fruit{
}
class Orange extends Fruit{
}
class FruitFactory{
pulic static Fruit getFruit(String fruitType){
if (“apple” == fruitType){
return new Apple();
} else if (“orange” == fruitType) {
return new Orange();
}
}
}