Question: how is the energy generated in a main sequence star
Answer: nuclear fusion of hydrogen atoms into helium