IIRC, somewhere back in time I saw a video of Navy ship with a Marine tank or mobile artillery on the deck firing rounds onshore during an engagement.
Yup, but you can’t leave it as a permanent feature of the ship. Land systems are usually not happy about being exposed to salt spray.