zoukankan      html  css  js  c++  java
  • 10.9zuoye

     1 public class fulei {
     2     public fulei()
     3     {
     4         System.out.println("欢迎使用海尔");
     5     }
     6     public String Pinpai;
     7     public String Xinghao;
     8     public fulei(String pinpai, String xinghao)
     9     {
    10         this.Pinpai = pinpai;
    11         this.Xinghao = xinghao;
    12         System.out.println(Pinpai+"饮水机
    "+"型号为"+Xinghao);
    13     }
    14     int t = 0;
    15     public void reshui(int 时间)
    16     {
    17         t = 时间;
    18         if(t > 15&&t<20)
    19         {
    20              System.out.println("保温");
    21         }
    22         else
    23         {
    24             System.out.println("加热");
    25         }
    26     }
    27     public void xiaodu(int 时间1)
    28     {
    29         t = 时间1;
    30         if(t >= 20)
    31         {
    32             System.out.println("消毒");
    33         }
    34     }
    35 }
    public class zilei1 extends fulei
    {
        public zilei1 (String Pinpai, String Xinghao)
        {
            super (Pinpai, Xinghao);
        }
        public zilei1()
        {
            String Pinpai = "美的";
            String Xinghao = "HB350";
            System.out.println("我是"+Pinpai+Xinghao);
        }
        int t;
        public void xiaodu(int t)
        {
            if(t > 65)
            {
                System.out.println("正在消毒");
            }
        }
    }
     1 public class test {
     2 
     3     public static void main(String[] args) {
     4         // TODO Auto-generated method stub
     5         fulei ysj1 = new fulei();
     6         fulei ysj = new fulei("Haier", "GB125");
     7             ysj.reshui(6);
     8             ysj.xiaodu(70);
     9             ysj.reshui(16);
    10             
    11         zilei1 ysj2 = new zilei1();
    12             ysj2.xiaodu(70);
    13             
    14         //向上转型调用方法    
    15             fulei ysj3 = new zilei1();
    16             ysj3.xiaodu(80);
    17     }
    18 
    19 }

  • 相关阅读:
    NodeJS、NPM安装配置步骤(windows版本)
    23种设计模式全解析
    js阻止浏览器默认事件
    js获取不同浏览器盒子宽度高度
    H5之重力感应篇
    JS中的call()和apply()方法
    html学习笔记
    less(css)语言快速入门
    power designer简单教程
    Strom开发配置手册
  • 原文地址:https://www.cnblogs.com/wgbs25673578/p/4884011.html
Copyright © 2011-2022 走看看