Originally posted by ram chandra:
...Is it true when you override equals method you have to override hashcode ? If so why ? ...
If 2 objects are equal according to their equals method, then they should return the same hashCode. This ensures that instances will behave correctly when stored in a collection that uses hashing, like HashSet or HashMap.
For more detail about hashCode and equals, see the API documentation for the hashCode method of java.lang.Object.
By the way, you might note that your hashCode method is overridden to return a constant, 12345.
In hex, this value is 3039, which is why you're seeing "WeirdStringFixed@3039."