Review Questions

graphics/rq_icon.gif

10.1

What is the return type of the hashCode() method in the Object class?

Select the one correct answer.

  1. String

  2. int

  3. long

  4. Object

  5. Class

10.2

Which statement is true?

Select the one correct answer.

  1. If the references x and y denote two different objects, then the expression x.equals(y) is always false.

  2. If the references x and y denote two different objects, then the expression (x.hashCode() == y.hashCode()) is always false.

  3. The hashCode() method in the Object class is declared final.

  4. The equals() method in the Object class is declared final.

  5. All arrays have a method named clone.

10.3

Which exception can the clone() method of the Object class throw?

Select the one correct answer.

  1. CloneNotSupportedException

  2. NotCloneableException

  3. IllegalCloneException

  4. NoClonesAllowedException