Both the D40 and its successor are discontinued. It would be better to go for something that's actually in production.
I suggested the D40 for a first time DSLR owner because it has been discontinued. They can be purchased new a very good price, there are several manuals and books available devoted just to their use, they accept all Nikon lens, and they are simple to use. I have a D80 and my son has a D70. His D70 can take just as good a picture as my D80 (which replaced the D70). IMO get a D40 and with the money you save get a 70/300 lens.