---
title: "What does the hashCode() method?"  
description: "What does the hashCode() method?"  
author: "Anonymous User"  
published: 2015-05-13  
updated: 2020-09-23  
canonical: https://www.mindstick.com/interview/2523/what-does-the-hashcode-method  
category: "java"  
tags: ["java", "collection"]  
reading_time: 1 minute  

---

# What does the hashCode() method?

The hashCode() method returns a hash code value (an integer number).

The hashCode() method returns the same integer number, if two keys (by calling equals() method) are same.

But, it is possible that two hash code numbers can have different or same keys.

## Answers

### Answer by Anonymous User

The hashCode() method returns a hash code value (an integer number).

The hashCode() method returns the same integer number, if two keys (by calling equals() method) are same.

But, it is possible that two hash code numbers can have different or same keys.


---

Original Source: https://www.mindstick.com/interview/2523/what-does-the-hashcode-method

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
