Theory:

Why do objects sink or float on the surface of the water?
  
Let us discuss an activity to understand the solution for the above question.
  • Take a glass beaker of ordinary transparent glass with water.
  • Place an iron nail and a piece of cork on the surface of the water.
Now, observe what happens.
 
It is obvious that the nail sinks. The gravitational force of the earth on the iron nail pulls it in a downward direction. At the same time, there is an upthrust of water on the nail, which pushes the nail in an upward direction. Since the downward force acting on the nail is greater than the upthrust of water on the nail. So it sinks.
 
We have already discussed the reason why the nail sinks. Now will see why the cork floats. This happens because of the difference in their densities.
 
What is density?
The density of a substance is defined as the mass per unit volume.
Density=MassVolume
 
The unit of density is kg/m3.
 
The density of cork is lesser than the density of water. This means that the upward force given by water on the cork is much greater than the weight of the cork.
The density of an iron nail is higher than that of the density of water. This means that the upward force given by water on the iron nail is lesser than the weight of the nail. So the nail sinks. Therefore objects of density less than that of a liquid float on the liquid. The objects of density greater than that of a liquid sink in the liquid.