A ship is a hollow object made up of iron and steel which contains a lot of air in it.
The density of air is very less.
Due to the presence of a lot of air its density becomes less than that of water(density of water 1g/ml).
Therefore it floats in water.
When a ship is placed in water it sinks to a certain level such that water which is displaced by the ship's submerged portion is equal to the whole weight of the ship.
Since the ship fulfills this condition of floating, it floats in water.