According to the law of floatation, a body floats on a liquid if it can displace the liquid equal to its weight. The body can displace the liquid equal to its volume. The volume of nails is less. So, it displaces less water and sinks. However, the ship displaces a large amount of water and floats due to the influence of high upthrust. Hence, an iron nail sinks in water but the ship made of iron floats.