小弟偶初学.一个问题整了半天整不出来.帮忙看看饿....Thangks  ..
import java.util.*;
class A implements Comparable{
    int i;
    A(int i){
this.i=i;
    }
    
   public String toString(){
      return ""+i;
   }
   public int hashCode(){
      return i;
   }
   public boolean equals(Object o){
      return i==((A)o).i;
 }
   public int compareTo(Object o){
      int m=((A)o).i;
      return (m<i ? -1 : (m==i ? 0 : 1));
   }
}
class B{
   String s;
   B(String s){
this.s=s;
   }   public String toString(){
return s;
   }
}public class C{
   public static void main(String[] args){
    HashMap hm=new HashMap();
    hm.put(new A(1),new B("a"));
    hm.put(new A(3),new B("c"));
    hm.put(new A(2),new B("b"));
    System.out.println(hm);
    HashMap hm1=new HashMap();
    hm1.put(new A(4),new B("d"));
    hm1.put(new A(3),new B("g"));
    hm1.put(new A(2),new B("h"));
    hm.putAll(hm1);
    System.out.println(hm);
    System.out.println("hm.containsKey(1) "+hm.containsKey(new A(1)));    
    System.out.println("hm.containsValue(new B(\"a\")) "+hm.containsValue(new B("a")));    //为什么这里输出的值 是  false    ??     }
}是不是  B类里也要设置点东西才可以调用 containsValue 方法啊??/