多选题

Given: 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?()

Apublic int hashCode()

Bpublic boolean equals(Key k)

Cpublic int compareTo(Object o)

Dpublic boolean equals(Object o)

Epublic boolean compareTo(Key k)

正确答案

来源:www.examk.com

答案解析

相似试题
  • Given: Which code, inserted at line 4, guarantees that this program will output [1, 2]?()

    多选题查看答案

  • Given: What can be a result?()

    单选题查看答案

  • Given: Which code, inserted at line 16, will cause a java.lang.ClassCastException?()

    单选题查看答案

  • Click the Exhibit button. Given: ClassA a = new ClassA();a.methodA(); What is the result?()

    单选题查看答案

  • Click the Exhibit button. Given: ClassA a = new ClassA();a.methodA(); What is the result?()

    单选题查看答案

  • Given: Which statement is true if a ResourceException is thrown on line 86?()

    单选题查看答案

  • Given: Which code, inserted at line 16, correctly retrieves a local instance of a Point object?()

    单选题查看答案

  • Given: Which code, inserted at line 16, correctly retrieves a local instance of a Point object?()

    单选题查看答案

  • Given: What is the result of calling search with a valid List implementation? ()

    单选题查看答案

  • Click the Exhibit button.   Given: ClassA a = new ClassA();   a.methodA();   What is the result?()

    单选题查看答案