After the red giant stage in its cycle, depending on its mass would determine how the star will end up. For stars greater than 1 solar mass but less than 2 solar masses, the hydrogen burning shell consumes its way outward leaving behind more helium ash. As helium piles up, the core becomes bigger and then contracts. By contracting, it becomes warmer to the point that the electrons degenerate. From gas, it will then become liquid becoming incompressible and further contraction stops.