• TestOverWrite


    package org.OverWrite;
    class Person{
    private String name;
    private int age;
    public void setName(String name){
    this.name=name;
    }
    public void setAge(int age){
    this.age=age;
    }
    public String getName(){
    return name;
    }
    public int getAge(){
    return age;
    }
    public String getInfo(){
    return "Name:"+name+" "+"age:"+age;
    }
    }

    class Employee extends Person{
    private int salary;
    public int getSalary(){
    return salary;
    }
    public void setSalary(int salary){
    this.salary=salary;
    }
    public String getInfo(){
    return "Name:"+getName()+" age:"+getAge()+" school:"+salary;
    }
    }
    public class TestOverWrite {

    public static void main(String[] arg[]) {
    // TODO 自动生成的方法存根
    Employee employee=new Employee();
    employee.setName("Mary");
    employee.setAge(20);
    employee.setSalary(2000);
    System.out.println(employee.getInfo());
    }
    }

  • 相关阅读:
    示波器测量电源的纹波
    hdoj 2717 Catch That Cow
    hdoj 1548 A strange lift
    hdoj 4586 Play the Dice
    zoj 2095 Divisor Summation
    hdoj 4704 Sum
    router-link传参
    字体自适应
    横向滚动div
    vue路由
  • 原文地址:https://www.cnblogs.com/wlp1115/p/6704928.html
Copyright © 2020-2023  润新知