Add some System.out.println in your equals method to check what the values of each division calculation. This will give you an indication as to why this is the case - and why are 2 rectangles equal...