
class Foo {

	// fields
	private int x;
	private float y;
	private String z;


	/* we need to identify the "significant
		fields" when overriding equals
		and hashCode.
	*/


	@Override 
	public boolean equals(Object obj) {
		if (!(obj instanceof Foo)) {
			return false;
		}

		Foo that = (Foo) obj;

		// assume all fields are significant

		return ( this.x == that.x &&
			 Float.compare(this.y,that.y) == 0 &&    // not a good solution
			 this.z.equals(that.z));
    }

}
