Heating For Nissan Altima

2002 Nissan Altima only gets heat when car reaches 40 miles per hour.Is it my thermastat, heater core or what?