The hashCode() method is utilized to return hash value of the specified int value.
Method Definition: def hashCode(): Int
Return Type: It returns hash value of the specified int value.
Example #1:
// Scala program of Int hashCode // method // Creating object object GfG
{ // Main method
def main(args : Array[String])
{
// Applying hashCode method
val result = ( 22 ).hashCode
// Displays output
println(result)
}
} |
Output:
22
Example #2:
// Scala program of Int hashCode // method // Creating object object GfG
{ // Main method
def main(args : Array[String])
{
// Applying hashCode method
val result = ( 5645 ).hashCode
// Displays output
println(result)
}
} |
Output:
5645