An object sinks in water if its average density is greater than the density of water. An object floats if its average density is less than the density of water. An iron nail is a solid piece of iron, and the density of iron is greater than the density of water, so it sinks. An iron ship, despite being made of iron, is designed with a large hollow volume filled with air. The total mass of the ship divided by this large volume (its average density) is less than the density of water, allowing it to float.