The reason why boats can float on water is all down to buoyancy, distribution of weight and density. Buoyancy is the upward force that a body experiences when it is placed in water. It is very different from gravity and the simple reason being that buoyancy acts against the body in upward lift or direction. The buoyancy of a body is greatly dependent on the density of the body. The density of the body is the distribution of weight per cubic metre of volume. What that means is a steel bar will easily sink in water while a ship made of steel, on the other hand, will float because the density of the ship is lesser than the density of the water surface. That is to say that the volume of water displaced by the weight of the ship is less than the total volume of the water available. Thus a heavy ship can float on water because the volume occupied by the ship is firstly quite high, thereby reducing the impact of the weight of the ship.
Although all of this is true about the volume and weight of the ship, the true magic occurs with upthrust in the water. The size and mass of an aircraft carrier are tremendous, but it manages to float on water because the weight for one is distributed through a wide area. Water is a highly dense liquid that is extremely difficult to compress; so when objects are placed in it, water exerts pressure in every direction. The exerted pressure is equal in all directions except the upward pressure that is experienced. The upward pressure is a result of an offset in net pressure resulting in the upthrust that is felt by the object. This upthrust is easy to understand if you’ve gone scuba diving; as you go deeper and deeper, the pressure you experience is tremendous. So in case of a boat, the net force supports the boat by acting on the boat from underneath. It should be understood the greater the weight of the ship, the further it sinks into the water. But as the boat sinks into the water, greater upthrust is created since the pressure of water increase greatly underneath the surface. The only reason that a ship completely sinks is because the load of the ship increased to a point where the upthrust that was created was not enough to counter the weight of the ship.