Files
spring-security-series/Java Design Patterns/javadevjournal/design/creational/abstractfactory/example2/AbstractFactoryPatternDemo.java
2022-03-20 09:31:02 -07:00

19 lines
737 B
Java

package javadevjournal.design.creational.abstractfactory.example2;
/**
* Client Class
*/
public class AbstractFactoryPatternDemo{
public static void main(String[] args){
AbstractFactory abstractFactory1 = MpbileFactoryProducer.getFactory(false);
IMobile onePlus = abstractFactory1.getMobile("Oneplus");
onePlus.brandName();
IMobile sony = abstractFactory1.getMobile("Sony");
sony.brandName();
IMobile lava = abstractFactory1.getMobile("Lava");
lava.brandName();
AbstractFactory abstractFactory2 = MpbileFactoryProducer.getFactory(true);
IMobile iphone = abstractFactory2.getMobile("iphone");
iphone.brandName();
}
}