多做题,通过考试没问题!

Java认证考试

睦霖题库>其他计算机考试>Java认证考试

public class Key {  private long id1;  private long 1d2;  // class Key methods  }  A programmer is developing a class Key, that will be used as a key in a standard java.util.HashMap. Which two methods should be overridden to assure that Key works correctly as a key?()

  • A、 public int hashCode()
  • B、 public boolean equals(Key k)
  • C、 public int compareTo(Object o)
  • D、 public boolean equals(Object o)
  • E、 public boolean compareTo(Key k)
正确答案:A,D
答案解析:
进入题库查看解析

微信扫一扫手机做题