⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 例5.5.txt

📁 《Java程序设计与应用》-张仕斌-源程序 《Java程序设计与应用》-张仕斌-源程序
💻 TXT
字号:
//例5.5 有继承时的构造方法。
public class Person
{
	protected String name,phone,address;
	public Person()
	{
		this(" ", " "," ");
	}
	public Person(String aName,String aPhone,String anAddress)
	{
		name = aName;
		phone = aPhone;
		address = anAddress;
	}
}
class Employees extends Person
{
		protected int id;
		protected String workphone;
		public Employees()
		{
			//此处隐含调用构造方法Person()
			this(0,"");
		}
		public Employees(int aId,String aPhone)
		{
			//此处隐含调用构造方法Person()
			id=aId;
			workphone=aPhone;
		}
}
class Professor extends Employees
{
	protected String research;
	public Professor()
	{
		super();
		research="";	
	}
	public Professor(int aId,String aPhone,String aResearch)
	{
		super(aId,aPhone);
		research=aResearch;
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -