Although dolphins are mammals and need to breathe air, they can sleep while swimming in the water. They achieve this by "half-sleeping," meaning that one half of their brain sleeps at a time while the other half remains awake and able to control their breathing and movement. This allows them to stay buoyant and maintain their position in the water while sleeping.