public class Person {
String name;
int age;
int id=1001;// 身份证号
public Person(){
System.out.println("我无处不在!");}
public Person(String name){
this.name = name;}
public Person(String name, int age){
this(name);
this.age = age;}
public void eat(){
System.out.println("人:吃饭");}
public void walk(){
System.out.println("人:走路");}}
public class Student extends Person {
String major;
int id=1002;// 学号
public Student(){
super();}
public Student(String major){
super();
this.major = major;}
public Student(String name, int age, String major){
// this.name = name;
// this.age = age;
super(name, age);
this.major = major;}
@Override
public void eat(){
System.out.println("学生:多吃有营养的食物");}
public void study(){
System.out.println("学生:学习知识");
this.eat();
super.eat();
walk();}
public void show(){
System.out.println("name = " + name + ", age = " + age);
System.out.println("id = " + this.id);
System.out.println("id = " + super.id);}}
public class SuperTest {
public static void main(String[] args){
Student s = new Student();
s.show();
System.out.println();
s.study();
Student s1 = new Student("Tom", 21, "IT");
s1.show();
Student s2 = new Student();}}