程序解析test.java 急求啊!!!
classem{stringname;em(stringstrname){name=strname;}publicvoidshowinfo(){system.out.pr...
class em
{string name;
em(string strname)
{name=strname;
}
public void showinfo()
{ system.out.println("name:"+name);}
}
class ma extends em
{string department;
ma(string strname,string strdept)
{super(strname);
department=strdept;}
public void showinfo()
{system.out.println("name:"+name);
system.out.println("title:ma of"+department);}
}
public class test
{ public static void main(string[]args)
{em zhang3=new em("张三");
ma li4=new ma("李四","人事处");
zhang3.showinfo();
li4.showinfo();
}
}
1.说明em类t ma类之间的关系.
2.上述源程序通过编译后,产生了多少个类文件,类名分别是什么?
3. 在test类的main()方法中,产生了多少个对象?对象名分别是什么?
4.写出ma类的成员变量和成员方法.
5.该程序编译之后,执行的结果是什么? 展开
{string name;
em(string strname)
{name=strname;
}
public void showinfo()
{ system.out.println("name:"+name);}
}
class ma extends em
{string department;
ma(string strname,string strdept)
{super(strname);
department=strdept;}
public void showinfo()
{system.out.println("name:"+name);
system.out.println("title:ma of"+department);}
}
public class test
{ public static void main(string[]args)
{em zhang3=new em("张三");
ma li4=new ma("李四","人事处");
zhang3.showinfo();
li4.showinfo();
}
}
1.说明em类t ma类之间的关系.
2.上述源程序通过编译后,产生了多少个类文件,类名分别是什么?
3. 在test类的main()方法中,产生了多少个对象?对象名分别是什么?
4.写出ma类的成员变量和成员方法.
5.该程序编译之后,执行的结果是什么? 展开
展开全部
1。ma是em的子类
2。一个,test.class
3.两个对象和两个方法,zhang3和li4
4,department; ma(string strname,string strdept)
public void showinfo()
{system.out.println("name:"+name);
system.out.println("title:ma of"+department);}
}
5,name:张三
name:李四
title:ma of人事处
2。一个,test.class
3.两个对象和两个方法,zhang3和li4
4,department; ma(string strname,string strdept)
public void showinfo()
{system.out.println("name:"+name);
system.out.println("title:ma of"+department);}
}
5,name:张三
name:李四
title:ma of人事处
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询