public class Pupil {
public String name;
public int age;
private double score;
public void setScore ( double score) {
this . score = score;
}
public void testing ( ) {
System . out. println ( "小学生" + name+ "考小学数学" ) ;
}
public void shhowInf ( ) {
System . out. println ( "学生名:" + name+ "\t年龄:" + age+ "\t成绩:" + score) ;
}
}
public class Graduate {
public String name;
public int age;
private double score;
public void setScore ( double score) {
this . score = score;
}
public void testing ( ) {
System . out. println ( "大学生" + name+ "考大学数学" ) ;
}
public void showInf ( ) {
System . out. println ( "学生名:" + name+ "\t年龄:" + age+ "\t成绩:" + score) ;
}
}
public class Extends01 {
public static void main ( String [ ] args) {
Pupil pupil = new Pupil ( ) ;
pupil. age= 20 ;
pupil. name= "小明" ;
pupil. setScore ( 90 ) ;
pupil. testing ( ) ;
pupil. shhowInf ( ) ;
System . out. println ( "=============" ) ;
Graduate gra = new Graduate ( ) ;
gra. name = "大明" ;
gra. age= 25 ;
gra. testing ( ) ;
gra. setScore ( 99 ) ;
gra. showInf ( ) ;
}
}