Created
August 17, 2018 18:25
-
-
Save arjunsk/b82d0fb55ac79e104e7d64c036e5abc5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package solver; | |
import products.DotMatrixPrinter; | |
import products.IPrinter; | |
import products.InkjetPrinter; | |
import products.LaserPrinter; | |
public class PrinterFactory { | |
public static IPrinter createPrinterInstance(String type){ | |
if(type.equalsIgnoreCase("INKJET")) | |
return new InkjetPrinter(); | |
else if(type.equalsIgnoreCase("DOTMATRIX")) | |
return new DotMatrixPrinter(); | |
else if(type.equalsIgnoreCase("LASER")) | |
return new LaserPrinter(); | |
else | |
return null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment