七,类的多态

实验程序如下:

 

package 学生;

public class person1 {

 public String name;

 public String birthday;

 public String grade;

 public String gender;

 public String province;

 public String city;

 private static int count=0;

 public person1(String name,String birthday,String grade,String gender,String province,String city) {

  this.name=name;

  this.birthday=birthday;

  this.grade=grade;

  this.gender=gender;

  this.province=province;

  this.city=city;

  count++;

  // TODO 自动生成的构造函数存根

 }

 public static void main(String[] args) {

  Student stud1=new Student("李明","1998-1-1","2017","男","青海省","西宁市","计算机","网络工程",88);

  stud1.show1();

  stud1.Setnumber();

  Student stud2=new Student("张三","1999-11-1","2018","男","四川省","成都市","计算机","物联网工程",98);

  stud2.show1();

  stud2.Setnumber();

  Student stud3=new Student("王二","2000-10-1","2017","女","辽宁省","大连市","计算机","计算机科学与技术",78);

  stud3.show1();

  stud3.Setnumber();

  stud1.searchname("张");

  stud2.searchname("张");

  stud3.searchname("张");

  stud1.searchplace("青海省");

 

二,实验心得

     

  本次实验较为复杂,经过多次实验尝试,仍没有得出实验结果,只提交了程序。会继续调试,通过查资料,问同学等,得出结论,深入了解。

 

posted @ 2019-05-06 21:50  cxm&  阅读(139)  评论(0编辑  收藏  举报