White dwarfs are the burned-out cores of stars that have collapsed into an extremely dense state with no empty space between atoms. They have a mass similar to the sun's but are very small, around the size of Earth. Neutron stars are created during supernova explosions from the central core of a star that collapsed under gravity. They are an extremely compact ball of neutrons that are very hot, small, dense, and have masses higher than the sun's. Both white dwarfs and neutron stars achieve extreme density through electron or quantum degeneracy pressure preventing further gravitational collapse.