package javaClassStudy;
/**
*
* @author yuxg
* 抽象类实践
*/
public abstract class Person {
private String name ;
private int age;
public Person(String name, int age) {
this.name = name;
this.age = age;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public void setAge(int age) {
this.age = age;
}
public int getAge() {
return age;
}
public abstract String getDescription();//描述
public abstract void live();//live
}
package javaClassStudy;
/**
*
* @author Administrator
*/
public class Student extends Person {
public Student(String name, int age) {
super(name, age);
}
@Override
public String getDescription() {
System.out.println("Name is:"+this.getName());
return "Name is:" + this.getName();
}
/**
*
*/
@Override
public void live() {
System.out.println("I live in a big house!"+this.getName());
}
}