• 实现手机的某些功能


    ---恢复内容开始---

    
    

    //父类
    package zuoye;

    
    

    public abstract class Phone {

    
    

    // 属性 品牌 类型
    private String pinpai;
    private String leiXin;

    
    

    public String getPinpai() {
    return pinpai;
    }

    
    

    public void setPinpai(String pinpai) {
    this.pinpai = pinpai;
    }

    
    

    public String getLeiXin() {
    return leiXin;
    }

    
    

    public void setLeiXin(String leiXin) {
    this.leiXin = leiXin;
    }

    
    

    // 方法
    public void call() {
    System.out.println("打电话");
    }

    
    

    public void faXinXin() {
    System.out.println("发信息");
    }

    
    

    public void shouXinXin() {
    System.out.println("收信息");
    }

    
    

    }






    //
    播放功能接口 package zuoye; public interface BouFang { public void BouFang(); } //连接wife接口 package zuoye; public interface LinWife { public void linWife(); } package zuoye; //智能手机实现照相和连接网络 public class Zhineg extends Phone implements ZhaoXiang,LinWife,BouFang{ @Override public void linWife() { // TODO Auto-generated method stub System.out.println("连接网络"); } @Override public void zhaoXian() { // TODO Auto-generated method stub System.out.println("照相网络"); } @Override public void BouFang() { // TODO Auto-generated method stub System.out.println("播放音频"); } }
    //实现照明功能的接口
    package zuoye;
    
    public interface ZhaoXiang {
        
        public void zhaoXian();
            
        
    
    }
    
    
    //实现类       拼装
    package zuoye;
    
    public class PuTong extends Phone implements BouFang{
    
        @Override
        public void BouFang() {
            // TODO Auto-generated method stub
            System.out.println("播放音频");
            
        }
        
        
        
    
    }
    //测试类
    package zuoye;
    
    public class Test {
        
        public static void main(String[] args) {
            
            PuTong p = new PuTong();
            p.BouFang();
            p.call();
            p.faXinXin();
            p.shouXinXin();
            
    
            System.out.println("----------
    ");
            Zhineg z = new Zhineg();
            z.linWife();
            z.zhaoXian();
            z.call();
            z.faXinXin();
            z.shouXinXin();
            z.BouFang();
            
        }
    
    }

    ---恢复内容结束---

  • 相关阅读:
    day1 UnicodeEncodeError: 'gbk' codec can't encode character 'xa0' in position 2490: illegal multibyte sequence 错误提示
    day2 Opencv + image
    day1 Opencv安装 python 2.7 (32位)
    2 oracle 实现上下键翻历史命令 rlwrap
    Windows下安装RaibbitMQ
    1. oracle12C的安装
    《万达哲学》------王健林
    MongoDB常用命令
    MongoDB让人恶心的配置
    MongoDB介绍及下载与安装
  • 原文地址:https://www.cnblogs.com/bichen-01/p/11213737.html
Copyright © 2020-2023  润新知