A specially designed ship called a submarine can float or submerge in water as desired. It has ballast tanks at its basement. When the submarine is to be submerged, these tanks are filled with sea water. As a result, the weight of the submarine becomes more than the weight of the water displaced and therefore,it submerges.
If the submarine has to come up, the tanks are emptied out, so the weight of the submarine decreases in comparison to the weight of the water displaced and the submarine rises to surface.