The electric energy is absorbed by electron in the ground state and is excited to the higher state of energy called the excited state.The excited state is not the stable state and the electron jumps back to the ground state and emits the photon related to the bandgap of the material.Daughter of the Forest