zoukankan      html  css  js  c++  java
  • 每日代码系列(21)

     1 interface Advertisement {
     2   public abstract void showAdvertisement();
     3   public abstract String getCorpName();
     4 }
     5 class AdvertisementBoard {
     6   public void show(Advertisement adver) {
     7     System.out.println(adver.getCorpName()+"的广告词如下:");
     8     adver.showAdvertisement();
     9   }
    10 }
    11 class WhiteCloudCorp implements Advertisement {
    12   public void showAdvertisement() {
    13     System.out.println("@@@@@@@@@@@@@@@@@@@@@@");
    14     System.out.println("飞机中的战斗机,哎yes!");
    15     System.out.println("@@@@@@@@@@@@@@@@@@@@@@");
    16   }
    17   public String getCorpName() {
    18     return "白云有限公司";
    19   }
    20 }
    21 class BlackLandCorp implements Advertisement {
    22   public void showAdvertisement() {
    23     System.out.println("**************");
    24     System.out.println("劳动是爹");
    25     System.out.println("土地是妈");
    26     System.out.println("**************");
    27   }
    28   public String getCorpName() {
    29     return "黑土集团";
    30   }
    31 }
    32 public class Example6_6 {
    33   public static void main(String[] args) {
    34     AdvertisementBoard board=new AdvertisementBoard();
    35     board.show(new BlackLandCorp());
    36     board.show(new WhiteCloudCorp());
    37   }
    38 }    
    39   
    40     

    有一件事一直在困扰着我?阅读量连续五天都只有个位数,我在考虑要不要结束这个系列,来点不一样的?你们说呢?评论告诉我。

  • 相关阅读:
    python kivy 简单入门
    django 入门实例
    window docker安装
    apache进程和用户请求的关系
    php cookie工作原理
    react-router 简单的nginx配置
    node单线程支撑高并发原理(node异步I/O)
    知识图谱
    java
    java
  • 原文地址:https://www.cnblogs.com/ljydbk/p/14143348.html
Copyright © 2011-2022 走看看