 A star 's life begins with the gravitational collapse of a <unk> nebula of material composed primarily of hydrogen , along with helium and trace amounts of heavier elements . When the stellar core is sufficiently dense , hydrogen becomes steadily converted into helium through nuclear fusion , releasing energy in the process . The remainder of the star 's interior carries energy away from the core through a combination of radiative and convective heat transfer processes . The star 's internal pressure prevents it from collapsing further under its own gravity . When the hydrogen fuel at the core is exhausted , a star of mass 0 @.@ 4 times greater than the Sun 's will expand to become a red giant . In some cases , it will fuse heavier elements at the core or in shells around the core . As the star expands it throws a part of its mass , enriched with those heavier elements , into the interstellar environment , to be recycled later as new stars . Meanwhile , the core becomes a stellar remnant : a white dwarf , a neutron star , or if it is sufficiently massive a black hole . 
