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 objects t1 = Time.now t2 = Time.new() t3 = Time.new(2020) t4 = Time.new(2001, 11, 11) # get hash code # and print results puts t1.hash puts t2.hash puts t3.hash puts t4.hash
hashmethod on the time objects and print the results.
View all Courses