打字猴:1.700469777e+09
1700469777 public interface ILetterProcess{
1700469778
1700469779 //首先要写信的内容
1700469780
1700469781 public void writeContext(String context);
1700469782
1700469783 //其次写信封
1700469784
1700469785 public void fillEnvelope(String address);
1700469786
1700469787 //把信放到信封里
1700469788
1700469789 public void letterInotoEnvelope();
1700469790
1700469791 //然后邮递
1700469792
1700469793 public void sendLetter();
1700469794
1700469795 }
1700469796
1700469797 在接口中定义了完成的一个写信过程,这个过程需要实现,其实现类如代码清单23-2所示。
1700469798
1700469799 代码清单23-2 写信过程的实现
1700469800
1700469801 public class LetterProcessImpl implements ILetterProcess{
1700469802
1700469803 //写信
1700469804
1700469805 public void writeContext(String context){
1700469806
1700469807 System.out.println(“填写信的内容……”+context);
1700469808
1700469809 }
1700469810
1700469811 //在信封上填写必要的信息
1700469812
1700469813 public void fillEnvelope(String address){
1700469814
1700469815 System.out.println(“填写收件人地址及姓名……”+address);
1700469816
1700469817 }
1700469818
1700469819 //把信放到信封中,并封好
1700469820
1700469821 public void letterInotoEnvelope(){
1700469822
1700469823 System.out.println(“把信放到信封中……”);
1700469824
1700469825 }
1700469826
[ 上一页 ]  [ :1.700469777e+09 ]  [ 下一页 ]