Did you ever think,that what will happen if the sun explodes,a very tensable stage,that may frighten you...
If the sun explodes,there is a very slight chance we'd notice it before we died.Anyone on the side of the plannet that is facing the sun would be boilde away in an instant by the x-ray and gamma radiation released in such an event.People who are in underground bunkers on the side of the planet facing away from the sun would experience some really weird phenomena including electrical aricing from metallic objects,hair standing on the end,water boiling in glasses on the table and other extreme examples of 'what radiation does to different things when things go pear shaped' before they die of radiation poisoning.It would be a battle to see whether they lived long enough for the shock wave of the explosion to reach the earth.The plannet would either disintegrate or have every last bit torn off down to the iron core but that would be a moot point because what would be left of the sun's plasma would absorb and melt the planet within a few days.
The atmosphere will start freezing,but before that hurricanes of the fiercest nature you've ever seen,would secur most of the planet.If it weren't for that,I'd say some portion of humanity would find a way to live for a long time.The sun warms the earth's surface amount.If the sun were to explode,the cooling would continue and the atmosphere would freeze in just few days.Now,the earth isn't going to cool to absolute zero given problem(at what temperature would the gases in the atmosphere change state?).Another fact is that all plant life would die and carbon dioxide will not be converted back into oxygen.
However,the warm water of the oceans is a very large storage area of heat.As the atmosphere cools,the oceans would start giving up this heat.Calculations suggest that it would take about three months for the oceans to begin to freeze.In the meantime,the air above the oceans would be much warmer than the air above the land(since the oceans are giving up heat,but the land isn't).This means that it would be warmer if you lived near the coast,but the temperature difference wuld create violent super storms there.
Also our survival would probably be measured in months,may be years,as the planet would eventually cool.Mineral resources would become scarce because it would become impossible to mine for minerals.Not only would it be far too energy-intensive but it in the extreme temperatures and that doesn't even bring into account what would be needed to build the environment suits that would be needed to go outdoors.There could also be problems with the lack of solar radiation exposure in ways that we havenot freeze pretty quickly-only tose with acess to totally weatherproof dwellings and a good deal of energy would survive the first few weeks.That's just form the colsd.An average person would have a very slim possibility of survival.
Well, I hope this has enlightened you.But do not worry,We still have approximately 5 billion years to go before we reach this horrifying stage.