The following is an example of how to draw a person.
Package COM. WZS. design;/*** big talk design mode -- page116 builder mode ** @ author administrator **/public class builderpattern {public static void main (string [] ARGs) {persondirepersonthindire= new persondirector (New personthinbuilder (); // thin personthindire. createperson (); system. out. println (); persondirector personfatdire= new persondirector (New personfatbuilder (); // fat personfatdire. createperson () ;}}/** conductor */class persondirector {private personbuilder; Public persondirector (personbuilder) {This. personbuilder = personbuilder;} // The Creator public void createperson () {personbuilder. buildhead (); personbuilder. buildbody (); personbuilder. buildarm (); personbuilder. buildleg () ;}}/** abstract class */abstract class personbuilder {public abstract void buildhead (); public abstract void buildbody (); public abstract void buildarm (); public abstract void buildleg ();}/** skinny */class personthinbuilder extends personbuilder {@ overridepublic void buildarm () {system. out. println ("thin hand. ") ;}@ overridepublic void buildbody () {system. out. println ("skinny body. ") ;}@ overridepublic void buildhead () {system. out. println ("Thin head. ") ;}@ overridepublic void buildleg () {system. out. println ("skinny leg. ") ;}}/** fat man */class personfatbuilder extends personbuilder {@ overridepublic void buildarm () {system. out. println ("fat man's hand. ") ;}@ overridepublic void buildbody () {system. out. println ("fat body. ") ;}@ overridepublic void buildhead () {system. out. println ("fat head. ") ;}@ overridepublic void buildleg () {system. out. println ("fat legs. ");}}