In general, yes, they will mount. You may not have all the functions, depending on how old they
are. D40, D40x, and D60 won't autofocus (they don't have a pin drive for the older autofocus
lenses). If they are really old and don't have contacts, you may be in full manual only, with
no metering (but histograms will still work).
Adm. Linda has a D40 that she uses with a 70-210 zoom (one I inherited 13 years ago) for wildlife
photography.
The details depend on the exact DSLR and lens (and vintage of the lens). I'd suggest some
searching on Nikon's website, be sure to read all the fine print and there's a ton of it. Nikon would
do themselves a favor to have "pick the camera on the left side and the lens on the right side and
we'll tell you how it will work" on their website.
Nikon's been pretty good about keeping their glass and cameras compatible compatible.
MMMM, time for a test. OK, back. I just got the Nikon 50mm f/1.4 I bought with my first Nikon
F in 1972 and put it on the D70. It worked. Full manual focus and aperture, no metering (though
I dialed the exposure right in with the histogram.
Next test: my 80-400 ImageStabilized, still in the Nikon lineup.. Seemed to work fine with the
F (which I had a heck of a time finding, and was really worried that it had disappeared), though
of course no image stabilization. I can't be 100% certain because the F didn't have film in it.
Next test the 18-70 (or whatever) kit lens that came with the D70. Full aperture worked, but
the lens has no aperture ring, and no stopdown lever, so you would have to shoot wide open
Canon, on the other hand, is on their third mount (breechlock, bayonet, EOS) since 1972. Linda
has several older Canon lenses, and the fact that they were obsoleted pushed her to Nikon (since
she can raid my lens collection)