According to
https://wiki.tfes.org/Sun" : The sun is a rotating sphere. It has a diameter of 32 miles and is located approximately 3000 miles above the surface of the earth."
But we know more about the sun namely that its surface temperature is about ten thousand degree Fahrenheit (yeah, no typing error, 10,000 is the number).
Of course, nobody went up there with a thermometer – it would melt and then evaporate like anything else at such high temperatures. So, how do we know ?
Well, it goes back to the 1800 when physicists realized that everything, including you and I, emits electromagnetic energy the amount of which (per unit time and surface area) depends on the material of its surface and its temperature. Many people make use of this using all kinds of night-vision goggles and cameras. Just google for “night vision” and “thermal imaging” or infrared radiation. Our eyes cannot see this electromagnetic radiation but snakes, for example, have sensors to pick up on that radiation to hunt down mammals which have a slightly higher temperature than the surrounding.
At higher temperatures materials can be seen to assume a dark-red color like the coils of an electric range, your toaster, or electric bathroom heater. Those of us who have worked – or still work – in an steel foundry know that the color of the molten iron is a unique indication of its temperature, the whiter the higher the temperature. No need to dip a thermometer into the liquid iron. Engineers use the equations governing electromagnetic radiation when they design and build the boilers for power plants, jet engines and even car engines. So, we know a lot about elector-magnetic radiation and apply to everyday problems rather successfully.
Hence, looking at the light coming from our sun and analyzing its content ( ultra-violet , rain-bow colors , infra-red ) we can deduce the temperature of the sun – some 10000 deg Fahrenheit, give or take.
Well, so why is that important ?
Like liquids, gases have the property of filling the available space. In this case, surrounded by empty space, a 32 miles diameter gas ball would just vanish in front of our eyes. Poof … gone. Come to think of it, it wouldn’t even have formed in the first place.