This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I have two objects lets say object 1 is t1 and object 2 is t2. I am assigning same integer value to this two objects,which is 10.Now I am confused how can I check if the both values are same for the object or not.And the second thing will the hash codes for these two objects will be same?(I believe not as ti.equals(t2) is giving me false).how can I check for the identical values here.
When you're saying you're assigning the same integer value to two objects, what do you mean? Do you mean that the object has an integer member variable, and you're assigning the number to that?
If so, then you'd check for equality by comparing those member variables. And if you've got two different objects, and you haven't overridden hashCode(), then they will probably have different hash codes. If you have overridden hashCode(), then it depends on how you've done that.