Ship is not a solid block of iron and steel. A ship is hollow object made of iron and steel which contains a lot of air in it. Air has a very low density. Due to the presence of a lot of air in it, the average density of the ship becomes less than the density of water, therefore, a ship floats in water.
1 5 1
iron nail sinks in water because it has a density more than wate whereas ship made of iron floats on water because it has a density less than water