A submarine or a ship can float because the weight of water that it displaces is equal to the weight of the ship. This displacement of water creates an upward force called the buoyant force and acts opposite to gravity, which would pull the ship down. Unlike a ship, a submarine can control its buoyancy, thus allowing it to sink and surface at will.