Practice complete employee classes

Employee class:

/** employees* Extraction of commonness * name, number, working method (Abstract) * / public class employee {private string name; private string ID; public employee (string name, string ID) {this. Name = name; this. Id = ID;} public String getName() { return name; } public void setNaem(String name) { this.name = name; } public String getId() { return id; } public void setId(String id) { this.id = id; }

}

Developer class:

/** r & D department class, a kind of employee, inherits the Employee class * * / public abstract class developer extends employee {public developer (string name, string ID) {super (name, ID);}// public abstract void work();

}

Maintainer class:

/** maintenance department class, a kind of employee, inherits * / public abstract class maintainer extends employee {public maintainer (string name, ID);}

}

Java EE class:

/** define JavaEE engineers * employees belonging to the R & D department, inherit the R & D department * / public class JavaEE extensions developer {public JavaEE (string name, ID);} public void work(){ System.out.println(super.getName()+"..."+ super. Getid() + "... Develop Taobao");}}

Net class:

/** network engineer, belonging to the maintenance department * inheriting the maintenance department * / public class net extensions maintainer {public net (string name, ID);} public void work(){ System.out.println(super.getName()+"..."+ super. Getid() + "... Develop Taobao");}

}

Test class:

//Public class test {public static void main (string [] args) {JavaEE EE EE = new JavaEE ("Zhang San", "development department 001"); EE. Work(); net net = new net ("Li Si", "maintenance department 005"); net. Work();}}

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>