From the August 2011 issue

The Sun is a G2V star and Rigel is a B8Iab. How do astronomers get the classifications this precise?

Nick Smith, Minot, North Dakota
By | Published: August 29, 2011 | Last updated on May 18, 2023

Stellar-classifications
Stellar classifications give a general idea of the star’s temperature, age, and composition. However, astronomers have obtained sophisticated spectra of stars, which provide more detailed information about the individual objects. Astronomy: Roen Kelly

… the causes of most of the stellar spectrum variations became apparent: They were variations in surface temperatures and luminosities (so, also gravities and pressures/densities) of stars. The spectral classes became surrogates for these physical quantities.

Trust classifications to give a general idea for what kind of star you are dealing with, but if you want accurate physical knowledge about the star, you’d have to look into data acquired via more sophisticated spectral studies.