package hhh;
class Person
{
static int count=0;
protected String name;
protected int age;
public Person(String n1,int a1)
{
name=n1;
age=a1;
count++;
}
public Person(String n1) {
this(n1,0);
}
public Person(int a1) {
this("未知名",a1);
}
public Person() {
this("未知名");
}
public void print() {
System.out.print(this.getClass().getName()+" ");
System.out.print("两个参数的构造方法被调用count="+this.count+" ");
System.out.println(" "+name+","+age);
}
}
public class hhhh extends Person{
protected String dept;
hhhh(String n1,int a1,String d1){
super(n1,a1);
dept=d1;
}
public static void main(String args[]) {
Person p1=new Person("王小红",21);
p1.print();
hhhh s1=new hhhh("王帅",19,"计算机");
s1.print();
}
}