java compare two objects by value code example Example: how to compare objects in java this.equals(other)