OperationEngineer.java:
package gendwang.cisco.com;
public interface OperationEngineer
{
public void writeTool();
public void deployService();
}
PPMDeveloper.java:
package gendwang.cisco.com;
public class PPMDeveloper
{
public void writeOperationTool()
{
System.out.println("I am writing the operation tool.");
}
}
Candidate.java:
package gendwang.cisco.com;
public class Candidate implements OperationEngineer
{
private PPMDeveloper developer;
public Candidate(PPMDeveloper developer)
{
this.developer = developer;
}
public void writeTool()
{
developer.writeOperationTool();
}
public void deployService()
{
System.out.println("I don't know how to deploy the service");
}
}
Test.java:
package gendwang.cisco.com;
public class Test
{
public static void main(String[] args)
{
OperationEngineer engineer = new Candidate(new PPMDeveloper());
engineer.writeTool();
engineer.deployService();
}
}