No. ==
compares the references. this means ==
compares where in the memory the object is saved. hashCode()
creates an integer from the attributes of an Object (the algorithm for this operation may vary from class to class). Comparison of objects should be done via o1.equals(o2)
.
2
solved what is hash code and how it same for two string and with new string it will give diffrent output?