问题及代码:
/*
*Copyright (c)2015,烟台大学计算机与控制工程学院
*All rights reserved.
*文件名称:Person.java
*作 者:单昕昕
*完成日期:2015年11月3日
*版 本 号:v1.0
*问题描述:建立类,继承类。
*程序输入:无。
*程序输出:无。
*/
import java.util.Scanner;
public class Test
{
class Person
{
String name;
String addr;
long pn;
String eaddr;
public String toString()
{
return "Person";
}
}
class Student extends Person
{
String [] status = {"freshman","sophomore","junior","senior"};
public String toString()
{
return "Student";
}
}
class Employee extends Person
{
int office,salary;
MyDate dateHired;
public String toString()
{
return "Employe";
}
}
class Staff extends Employee
{
String title;
public String toString()
{
return "Staff's title is " + title;
}
}
class Faculty extends Employee
{
String rank;
int officeHour;
public String toString()
{
return "Faculty";
}
}
class Mydate
{
int year,month,day;
}
public static void main(String[] args)
{
}
}