interface ClassName{ public void getClassName(); } class A implements ClassName{ public void getClassName(){ System.out.println("\t"); System.out.println(" 易金易投资管理有限公司"); } } public class Company { public static void main(String[] args) { A a=new A(); a.getClassName(); } }
abstract class Employee3{ private String name ; private String sex; private int age ; public Employee3(String name,String sex,int age){ this.name = name; this.age = age; this.sex = sex; } public String getName(){ return this.name; } public String getSex(){ return this.sex; } public int getAge(){ return this.age; } public void say(){ System.out.println(this.getContent()); } public abstract String getContent(); }; class Guanliceng extends Employee3{ private String zhiwu1; private float nianxin; public Guanliceng(String name,String sex,int age,String zhiwu1,float nianxin){ super(name,sex,age); this.zhiwu1=zhiwu1; this.nianxin=nianxin; } public String getZhiwu1(){ return this.zhiwu1; } public String getContent(){ return "管理者信息 --> 姓名:" + super.getName()+ ";性别:"+super.getSex()+";年龄:" + super.getAge()+ ";职务:" + this.getZhiwu1()+";年薪:"+this.nianxin; } } class Zhigong extends Employee3{ private String zhiwu2; private float yuexin; public Zhigong(String name,String sex,int age,String zhiwu2,float yuexin){ super(name,sex,age); this.zhiwu2=zhiwu2; this.yuexin=yuexin; } public String getZhiwu2(){ return this.zhiwu2; } public String getContent(){ return "职员信息 --> 姓名:" + super.getName()+ ";性别:"+super.getSex()+";年龄:"+ super.getAge()+ ";职务:" + this.getZhiwu2()+";月薪:"+this.yuexin; } } public class Employee2{ public static void main(String args[]){ Employee3 emp2 = null ; Employee3 emp3 = null ; emp2 = new Guanliceng("张三","男",20,"主任",145003.5f); emp3 = new Zhigong("李四","男",30,"管理层",4000.0f); System.out.println("\t"); emp2.say(); System.out.println("\t"); emp3.say(); } }