public class AnimalFactory public static Animal createAnimal String an

1
2
3
4
5
6
7
8
9
public class AnimalFactory {
public static Animal createAnimal(String animal) {
if (animal.equals(Cat))
return new Cat();
else if (animal.equals(Cat))
return new Cat();
else return null;
}
}