class Demo6 {
public static void main(String[] args) {
Person p = new Person("张三");
Student s = new Student();
p.show();
s.shows();
}
}
class Person {
String name = "李四";
public Person() { }
public Person(String name){
this.name = name;
}
public void show(){
System.out.println(name);
}
}
class Student extends Person{
public void shows(){
System.out.println(name);
}
} |
|