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 ;
}
}
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:
Post a Comment