class Person1
{
protected String name;
protected int age;
public Person1(String name,int age)
{
this.name=name;
this.age=age;
}
protected void show()
{
System.out.println("姓名:"+name+" 年龄:"+age);
}
}
class Student1 extends Person1
{
private String department;
public Student1(String name,int age,String dep)
{
super(name,age);
department=dep;
}
public void show()
{
System.out.println("系别:"+department);
}
public void subshow()
{
System.out.println("我在子类中!");
}
}
public class App8_4 {
public static void main(String []args)
{
Person1 per=new Student1("李强",20,"管理");
Student1 stu=new Student1("王永涛",24,"电子");
stu.show();
stu.subshow();
}
}