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

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

  1. Object
  2. int
  3. long
  4. void

Answer

b. int

Explanation:

Answer: (b) int

Explanation: In Java, the return type of hashCode() method is an integer, as it returns a hash code value for the object.

Hence, the correct answer is an option (b).

Free Spring Boot Tutorial - 5 Hours Full Course


Watch this course on YouTube at Spring Boot Tutorial | Fee 5 Hours Full Course