• 14


    abstract class A{
        private String name;
        public A(String name) {
            this.name = name;
        }
        public String getName() {
            return this.name;
        }
        public abstract void fun();
    }
    class B extends A{
        public B(String name) {
            super(name);
        }
        public void fun() {
            System.out.println(super.getName());
        }
    }
    public class L {
        public static void main(String[] args) {
            // TODO Auto-generated method stub
            B b = new B(null);
            b.fun();
        }
    }
    import java.sql.Date;
    
    @SuppressWarnings("unused")
    public abstract class Y {
        private String name;
        private String Class;
        private String date;
    
    public String getName() {
        return this.name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String GetClass() {
        return this.Class;
    }
    public void setClass(String Class) {
        this.Class = Class;
    }
    public String getDate() {
        return this.date;
    }
    public void setDate(String date) {
        this.date = date;
    }
    public Y(String name,String Class,String date) {
        this.name = name;
        this.Class = Class;
        this.date = date;
    }
    public Y() {
        super();
    }
    
    @Override
    public String toString() {
        return "Student [name=" + name + "]";
    }
    public abstract String speak();
    
    }
    import java.sql.Date;
    @SuppressWarnings("unused")
    public class H extends Y{
        private String matter;
        public H(String name,String Class,String date,String matter) {
            super(name,Class,date);
            this.setMatter(matter);
        }
        @Override
        public String speak() {
            return "我叫 " + super.getName() + " 今年 " + super.GetClass() + " 身高 " + super.getDate() + " 体重 " + this.matter;
        }
        public String getMatter() {
            return matter;
        }
        public void setMatter(String matter) {
            this.matter = matter;
        }
        
    }
    public class K {
    
        public static void main(String[] args) {
            // TODO Auto-generated method stub
            Y stu = new H("cty,","21岁了,","175cm,",62KG。");
            print(stu.speak());
        }
    
        private static void print(String speak) {
            System.out.println(speak);
            
        }
    
    }
  • 相关阅读:
    查看crontab的日志记录定位定时任务问题
    Latex 表格内公式换行方法
    C语言中qsort函数用法
    7 种常用的排序算法-视觉直观感受
    Ubuntu下如何安装YouCompleteMe插件
    Linux下非root用户如何安装软件
    系统进化树-原理介绍及软件使用
    LaTeX 页眉页脚的设置
    TEXshade教程- 多重比对着色软件包
    easyUI自带的时间插件日期选择、月份选择、时间选择的使用
  • 原文地址:https://www.cnblogs.com/Archon-Cty/p/8057265.html
Copyright © 2020-2023  润新知