Stars generate their own energy by nuclear fusion. Based on the energy produced by that process, EM radiation over the entire spectrum is produced in the outer layers of a star through a multitude of processes and interactions.
Generally, the light we receive from a star, only tells us about what is happening in the outer layers of the star, not what happens in the inner part where the fusion process generates the energy. The visible part of the spectrum of e.g. our Sun, originates from the breakdown of a peculiar particle called the negative Hydrogen atom (ion) in the photosphere, emitting photons in the entire visible range of the spectrum, as well as in infrared.
We only need to look at a rainbow to appreciate that sunlight consists of the various colours of the visible spectrum. With a prism or a special instrument called a spectrograph (see below), we can stretch light spatially into different wavelengths, to study how the light we receive, is composed of different wavelengths or frequencies.
So generally, stars emit a continuous spectrum, although there can be differences in the intensity between different wavelengths.
|The rainbow is a natural spectrum caused by the refraction and reflection of sunlight through raindrops, and also shows that sunlight consists of a continuous envelope of colours from red to violet. Sometimes you can see a fainter outer bow caused by double reflections inside the raindrops.|