Solution:•Nuclear fusion: This is the primary energy source of stars during their main sequence and later stages. In the core of stars, lighter atomic nuclei (mainly hydrogen) fuse together to form heavier nuclei (like helium), releasing tremendous amounts of energy in the process according to Einstein's famous equation, E=mc².
•Gravitational contraction: During the early stages of a star's formation, gravitational contraction plays a significant role in heating the core to temperatures high enough to initiate nuclear fusion. However, once stable nuclear fusion begins, it becomes the dominant energy source, counteracting further gravitational collapse. Gravitational contraction can become important again in the later stages of a star's life when nuclear fuel is exhausted.