• 继承


    package com.jredu.ch06;
    
    public class Engineer {
        String no;
        String name;
        String time;
        
        public void ShowInfo(){
            System.out.println("我的编号:"+no+"我的姓名:"+name+"入职时间:"+time);
        }
        
        public Engineer() {
            super();
        }
    
        public Engineer(String no, String name, String time) {
            super();
            this.no = no;
            this.name = name;
            this.time = time;
        }
        
    }
    package com.jredu.ch06;
    
    public class SoftEngineer extends Engineer{
        String type;
        
        public SoftEngineer(String no, String name, String enterTime, String type) {
            super();
            super.no = no;
            super.name = name;
            super.time = enterTime;
            this.type = type;
        }
        @Override
        public void ShowInfo() {
            System.out.println("我的编号:"+no+"我的姓名:"+name+"入职时间:"+time+"种类:"+type);
        }
        public void coding(){
            System.out.println("我不是好人!");
        }
    }
    package com.jredu.ch06;
    
    public class SoftEngineerTest {
    
        public static void main(String[] args) {
            SoftEngineer softEngineer = new SoftEngineer("10001", "张三", "2016-08-05", "中文");
            softEngineer.ShowInfo();
            softEngineer.coding();
        }
    
    }

  • 相关阅读:
    eval解析的函数传参 object array
    whistle证书过期或不信任
    isa hasa的区别、及理解
    JVM工作原理和特点
    Cookie跨域操作
    关闭当前窗口js
    css遮罩层
    js 获得两个数组的重复元素
    主页变灰
    js 格式化日期
  • 原文地址:https://www.cnblogs.com/xiaolei121/p/5740346.html
Copyright © 2020-2023  润新知