This is the most basic way to classify stars. Essentially, it looks at the colour of a star, and classifies it on the basis of that. Now, there are strong correlations between the colour of a star and a few other features, most notably surface temperature. (Temperature is give in degrees Kelvin (K), where T(°K)=T(°C) + 273.15) For that reason, most astronomers just make the jump from colour to surface temperature when labeling stars. The classification is listed below:
O: Blue: >30,000K
B: Blue-white: 10,000 - 30,000K
A: White: 7.500 - 10,000K
F: Yellow-white: 6,000 - 7,500K
G: Yellow: 5,200 - 6,000K
K: Orange: 3,750 - 5,200K
M: Red: < 3,700K
This may be most easily remembered with mnemonic “Oh Be A Fine Girl Kiss Me!" (No chauvinism is intended with this mnemonic: some astronomers out there may wish to replace “girl" with “guy", depending on their personal preferences.) This goes from hottest to coldest, blue to red. Think of how the blue heart of a flame is hotter than its flickering red extremities. Within each class, stars may further by subdivided 0-9 by their color, again by hottest to coldest.
You may be wondering about a few things at this point. One, why this particular arrangement of letters and not something, say, alphabetic? And two, why are the gaps in temperature between the stars uneven? Well, both of these are for historical reasons that are complex, varied, and frankly not all that interesting to most people. (Check out the resource section at the end of the article if you're one of those who are, in fact, interested.) Basically, astronomers just put up with these quirks because that's how things are done, and no one has any real impetus to go about changing them.
Now, it should be noted that many additional classes have been invented in recent years for new types of stars, for instance W for Wolf Rayet stars or T for methane stars. However, these form a small minority of stars, and will not be discussed in this article.