The hash code of an object is a unique integer value. It differentiates an object from another. Objects with the same value have the same hash code.
t_o
: The name of the time object whose hash code we want to obtain
It returns the hashcode of the time object.
# create time objectst1 = Time.nowt2 = Time.new()t3 = Time.new(2020)t4 = Time.new(2001, 11, 11)# get hash code# and print resultsputs t1.hashputs t2.hashputs t3.hashputs t4.hash
t1
,t2
, t3
, and t4
.hash
method on the time objects and print the results.