(Definition: Provide an interface to create a target. Why use it? The factory pattern is the most commonly used pattern. The famous Jive forum uses the factory pattern a lot. The factory pattern can be seen everywhere in the Java program system. Why is the factory pattern so commonly used? Since the factory pattern is equivalent to creating an instance target new, we often need to generate instance targets based on the class Class, such as Aa=newA() The factory pattern is also used to create instance targets, so in the future, when new If you need multiple minds, you can think about the effective factory pattern. Although doing so will do a lot of work, it will bring greater scalability to your system and minimize the amount of modification. Let's take the class Sample as an example, if we want to create an instance target of Sample:
JAVA Design Patterns.chm)