//下面的程序中主方法当中的最后两句为什么打印false??
import java.util.*;
import java.io.*;
public class Test{
public static void main(String[]args)throws Exception{
HashMap hm = new HashMap();
hm.put(new StudentKey("200601","200601"),new StudentValue("张三丰","男","计算机","软件工程","20"));
ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("studentData"));
oos.writeObject(hm);
FileInputStream fis = new FileInputStream("StudentData");
ObjectInputStream ois = new ObjectInputStream(fis);
hm = (HashMap)ois.readObject();
System.out.println(hm);
Set set = hm.keySet();
System.out.println(set);
StudentKey sk = new StudentKey("200601","200601");
StudentKey sk1 = new StudentKey("200601","200601");
//下面为什么打印false????
System.out.println(set.contains(sk));
System.out.println(hm.containsKey(sk));
}
}
class StudentKey implements Serializable{
Strin
|