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