class Student
{
String name;
String age;
public void show(){
System.out.println("名字:"+name+" 年龄:"+age);
}
}
class Undergraduate extends Student{
String degree;
public Undergraduate(String name,String age,String degree){
super.name=name;
super.age=age;
this.degree=degree;
}
public void show(){
super.show();
System.out.println("学位:"+degree);
}
}
public class Ch1
{
public static void main(String[] args)
{
Undergraduate und=new Undergraduate("张三","20","博士");
und.show();
}
}
{
String name;
String age;
public void show(){
System.out.println("名字:"+name+" 年龄:"+age);
}
}
class Undergraduate extends Student{
String degree;
public Undergraduate(String name,String age,String degree){
super.name=name;
super.age=age;
this.degree=degree;
}
public void show(){
super.show();
System.out.println("学位:"+degree);
}
}
public class Ch1
{
public static void main(String[] args)
{
Undergraduate und=new Undergraduate("张三","20","博士");
und.show();
}
}