电脑桌面
添加小米粒文库到电脑桌面
安装后可以在桌面快捷访问

试验五集合的使用资料

试验五集合的使用资料_第1页
1/10
试验五集合的使用资料_第2页
2/10
试验五集合的使用资料_第3页
3/10
EXP3 课题( 项目 ) 名称 :实验五集合的使用计划学时 : 2 实验类型 : 1. 演示性□ 2.验证性□ 3.综合性□ 4.设计性□ 5.其它□授课日期 : 年月日第周星期第节实验目的1. 验证集合的使用2. 学习集合的应用技术实验要求1. 掌握 List的使用2. 掌握 Set 的使用3. 掌握 Map的使用4. 理解集合应用技术实验内容与步骤1. 集合基本操作(1) 编写存入集合的对象类class Person { String id; String name; Person(String id,String name) { this.id=id; this.name=name; } public void sleep() { System.out.println("I am Person,I am sleeping"); } public void eat() { System.out.println("I am Person,I am eating"); } } class Student extends Person { String sno; Student(String id,String name,String sno) { super(id,name); this.sno=sno; } public void study() { System.out.println("I am Student,I am studying"); } public void eat() { System.out.println("I am Student"); System.out.println("id:"+id); System.out.println("name:"+name); System.out.println("sno:"+sno); System.out.println("eating .........."); } public String toString(){ return "Student "+"ID:"+this.id +" Name:"+this.name +" SNo:"+this.sno; } } class Teacher extends Person { String tid; Teacher(String id,String name,String tid) { super(id,name); this.tid=tid; } public void tech() { System.out.println("I am Student,I am taching"); } public void eat() { System.out.println("I am Teacher"); System.out.println("id:"+id); System.out.println("name:"+name); System.out.println("tid:"+tid); System.out.println("eating .........."); } public String toString(){ return "Teacher "+"ID:"+this.id +" Name:"+this.name +" Tid:"+this.tid; } } (2) 创建测试类 , 完成以下操作a. 创建 3 个 Student 的对象 ,2 个 Teacher 对象b. 创建一个 List和一个 Set c. 将 a 中创建的 5 个对象加入到 List中d. 将 a 中创建的 5 个对象加入到 Set 中e. 编写一个 static方法, 可以对 b 中中创始的集合进行遍历 , 将集合中每个元...

1、当您付费下载文档后,您只拥有了使用权限,并不意味着购买了版权,文档只能用于自身使用,不得用于其他商业用途(如 [转卖]进行直接盈利或[编辑后售卖]进行间接盈利)。
2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。
3、如文档内容存在违规,或者侵犯商业秘密、侵犯著作权等,请点击“违规举报”。

碎片内容

试验五集合的使用资料

确认删除?
VIP
微信客服
  • 扫码咨询
会员Q群
  • 会员专属群点击这里加入QQ群
客服邮箱
回到顶部