package com.sibisoft.faizaniftikhartdd;

public class Money 
{
	protected int amount;
	
	public Money() 
	{
		
	}
	public boolean equals(Object object)
	{
		Money money= (Money) object;
		return amount == money.amount;
	}
}

package com.sibisoft.faizaniftikhartdd;

public class Money 
{
	protected int amount;
	
	public Money() 
	{
		
	}
	public boolean equals(Object object)
	{
		Money money= (Money) object;
		return amount == money.amount && getClass().equals(money.getClass());
	}
}

Add getClass() method to validate equals both same classes which make our equality test case succeed
Add getClass() method to validate equals both same classes which make
our equality test case succeed