资源简介
学士后Java集合框架和泛型课后习题答案
希望能够帮助大家更好的学习JAVA,这些知识还是比较基础的,并没有多大难度
一起共同进步
代码片段和文件信息
package entity;
import java.util.HashMap;
import java.util.Scanner;
public class Homework2 {
public static void main(String[] args) {
HashMap students=new HashMap();
Scanner input=new Scanner(System.in);
Student stu1=new Student(“杨过“ 95);
Student stu2=new Student(“小龙女“ 99);
Student stu3=new Student(“张无忌“ 88);
Student stu4=new Student(“赵敏“ 90);
students.put(“杨过“ stu1);
students.put(“小龙女“ stu2);
students.put(“张无忌“ stu3);
students.put(“赵敏“ stu4);
System.out.println(“请输入学生姓名:“);
String key=input.next();
if(students.containsKey(key)){
Student stu= students.get(key);
System.out.println(stu.getName()+“的成绩是:“+stu.getScore());
}
System.out.println(“----------所有学生的成绩是-----------“);
for(object value:students.values()){
Student stu=(Student) value;
System.out.println(stu.getName()+“的成绩是:“+stu.getScore());
}
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 301 2016-02-26 11:51 CollectionHomework\.classpath
文件 394 2016-02-26 11:51 CollectionHomework\.project
文件 598 2016-02-26 11:51 CollectionHomework\.settings\org.eclipse.jdt.core.prefs
文件 2380 2016-02-28 16:08 CollectionHomework\bin\entity\Homework2.class
文件 2698 2016-02-28 17:54 CollectionHomework\bin\entity\Homework3.class
文件 2928 2016-02-28 18:15 CollectionHomework\bin\entity\Homework4.class
文件 1810 2016-02-28 18:12 CollectionHomework\bin\entity\Student.class
文件 1001 2016-02-27 23:31 CollectionHomework\src\entity\Homework2.java
文件 1251 2016-02-28 17:54 CollectionHomework\src\entity\Homework3.java
文件 1443 2016-02-28 18:15 CollectionHomework\src\entity\Homework4.java
文件 1260 2016-02-28 18:12 CollectionHomework\src\entity\Student.java
目录 0 2016-02-28 18:17 CollectionHomework\bin\entity
目录 0 2016-02-28 18:17 CollectionHomework\src\entity
目录 0 2016-02-28 18:17 CollectionHomework\.settings
目录 0 2016-02-28 18:17 CollectionHomework\bin
目录 0 2016-02-28 18:17 CollectionHomework\src
目录 0 2016-02-28 18:17 CollectionHomework
----------- --------- ---------- ----- ----
16064 17
评论
共有 条评论