Compare commits

...

2 Commits
main ... scr

@ -0,0 +1,6 @@
public class ConcreteProductA implements Product {
@Override
public void operation() {
System.out.println("ConcreteProductA operation");
}
}

13
scr

@ -0,0 +1,13 @@
public class Factory {
public static Product createProduct(String type) {
if (type == null) {
return null;
}
if (type.equalsIgnoreCase("A")) {
return new ConcreteProductA();
} else if (type.equalsIgnoreCase("B")) {
return new ConcreteProductB();
}
return null;
}
}
Loading…
Cancel
Save