That is how it works. I remember doing some computer work for a company that developed aircraft electronics. In the back room with the ups and such were a couple of motor-generators that produced 400hz power, which is used in large jets. This was routed to the test benches and such.
They have been used as online ups for a long time, usually with a flywheel to store the energy. Very low maintenance devices, that have been around for ages.