Review Questions

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 ...

Get Programmer's Guide to Java™ Certification, A: A Comprehensive Primer, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.