Answer
See explanation below.
Work Step by Step
A guitar string vibrates in several modes simultaneously.
The string stretches between the nut and the saddle
That distance represents 1/2 wavelength, which produces the primary pitch you hear.
A number of harmonics are also produced by additional wavelengths, like 1, 1.5, 2, etc.
If you think of that string formed into a circle then you have an interpretation of an electron vibrating in an orbit around the nucleus.
The key point is that the electron has a wavelength.
And if a circumference happens to be an integer multiple of the wavelength
then that orbit is "allowed" because "the electron retraces its own path."
All the other orbits are disallowed because the electron wave basically cancels itself out.
(an + amplitude cancels a - amplitude when the waves add.)
This explains why there is a line spectrum rather than a continuous spectrum.
A line spectrum represents an electron jumping between specific energy levels, producing only specific colors.
A continuous spectrum would mean that the electron could jump anywhere, producing all the colors.