In a generator, mechanical energy is converted into which of the following?

an electromagnet
a moving rod
a magnetic field
electrical energy