public class People {
int age = 10;
public People(){
}
public int getAge(){
return age;
}
}
public class Teacher extends People {
int age = 19;
}
public class PeopleDemo {
public static void main(String[] args) {
Teacher v=new Teacher();
System.out.println(v.getAge());
System.out.println(v.age);
}
输出结果10;
19