This is an interesting case of programming where you need to compare two POJO objects. You might need to compare standalone objects or you may need to uniquely identify them in a collection. This can be achieved by overriding equals() and hashCode() methods.