{{theTime}}

Search This Blog

Total Pageviews

Factory Method Design Pattern Java Implementation

    interface JavaCertification {

        public JavaCertification getCertificate() ;

    }
    class OCJPCertification implements JavaCertification {     
        public JavaCertification getCertificate(){         
            return new OCJPCertification() ;
        }
    }

    class OCWCDCertification implements JavaCertification {     
        public JavaCertification getCertificate(){         
            return new OCWCDCertification() ;
        }
    }

    class CertificationBuilder {

        public CertificationBuilder() {}

        public JavaCertification getCertifcate(String certificate){         
            if(certificate.equalsIgnoreCase("OCJP")){
                return new OCJPCertification() ;
            }else if(certificate.equalsIgnoreCase("OCWCD")){
                return new OCWCDCertification() ;
            }
            return null ;
        }
    }


No comments:

Best Client Optimized Programming Language for Mobile Development?

Use Google's Dart language, which is Object-oriented, class-based and garbage-collected language with C-Style.  Dart can compile to eith...