• 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);
            
        }
    
    }
  • 相关阅读:
    java.lang.ClassNotFoundException: com.sun.tools.javac.Main (Liferay运行ant build.xml执行错误)
    JS正则验证手机号码或者电话号码(转)
    ResultSet用法
    IntelliJ IDEA 快捷键和设置
    Ext.MessageBox消息框
    vim + cscope + ctags + taglist配置
    ExtJs 确认密码验证的实现
    一道关于排列组合的算法题
    把Boost更新到了1.35
    发布Flv合并器的.net版
  • 原文地址:https://www.cnblogs.com/Archon-Cty/p/8057265.html
Copyright © 2020-2023  润新知