The term 'battery' has also been used in association with warships. Early warships that mounted guns, such as the ship of the line, mounted dozens of cannons, carronades, and other guns in broadsides, sometimes on several decks. This remained the standard layout for centuries, until new designs, such as the revolving turret, made it obsolete.
One of the first rotating turrets was designed by John Ericsson, for use on the American ironclad USS Monitor. Other designs used open barbettes to house their main batteries on rotating mounts. Both designs allowed naval engineers to dramatically reduce the number of guns present in the battery, by giving a handful of guns the ability to concentrate on either side of the ship.
A revolution in ship armament occurred in 1906, with the completion of HMS Dreadnought. In previous battleship designs, the primary battery often consisted of four large caliber guns in two turrets, one in the front of the ship, and one aft. The ships also had a mixed secondary battery of smaller guns, but were also intended to be used offensively. The differences in gun calibers and ranges made it difficult to accurately judge shell splashes, and thus to fire the guns accurately, which led to decreased effectiveness of the ships. Dreadnought's design did away with the offensive secondary battery, and replaced it with ten heavy caliber guns, and a smaller secondary battery to be used for self-defense. This leap in armament made all other battleships obsolete.
Often, ships have a primary battery for offensive purposes, and a secondary and sometimes even a tertiary battery for self-defense. An example of this was the German battleship Bismarck, which carried a primary battery of eight 15 inch (380mm) guns, along with a secondary battery of twelve 5.9 inch (150mm) guns for defense against destroyers and torpedo boats, as well as a tertiary battery of various anti-aircraft guns ranging in caliber from 4.1 inch (105mm) to 20mm guns. Many later ships used dual-purpose guns to combine the secondary battery and the heavier guns of the tertiary batteries, in order to simplify the design.
Most modern vessels have largely done away with conventional artillery, instead using cruise and guided missiles for most offensive and defensive purposes, respectively. Guns are retained for niche roles, such as the Phalanx CIWS, a multi-barrel rotary cannon used for point defense, the Mark 45 5 inch, or the Otobreda 76 mm which is used for close defense against surface combatants and shore bombardment.