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

A.an electromagnet

B.a moving rod

C.a magnetic field

D.electrical energy