1. Factory method mode (each specific role is generated by its specific factory), ①, abstract role ②, specific role ③, abstract factory ④, factory abstraction factory mode (the difference between factory mode and factory mode lies in the complexity of object creation) ①. Abstract role: package method. factory; public interface implements actmove {public void run () ;}②, specific role package method. factory; public class Bus implements actmove {@ Overridepublic void run () {// TODO Auto-generated method stubSystem. out. println ("This is a Bus running") ;}} package method. factory; public class Plan implements actmove {@ Overridepublic void run () {// TODO Auto-generated method stubSystem. out. println ("This is Plan running") ;}③, abstract factory package method. factory; public abstract class implements actfactory {abstract AbstractMove create ();} ④, the specific factory package method. factory; public class BusFactory extends actfactory {@ overridemo-actmove create () {// TODO Auto-generated method stubreturn new Bus () ;}} package method. factory; public class PlanFactory extends actfactory {@ overridemo-actmove create () {// TODO Auto-generated method stubreturn new Plan () ;}} Test: package method. factory; public class Test {public static void main (String [] args) {// TODO Auto-generated method stub1_actfactory af = new PlanFactory (); AbstractMove move = af. create (); move. run (); AbstractFactory af1 = new BusFactory (); AbstractMove move1 = af1.create (); move1.run () ;}} result: This is Plan runningThis is a Bus running