I just bought a Nikon AF 70-300mm F/4-5.6 G lens before I realized that I need an AF-S lens. I was just wondering if I will still be able to use the auto-focus with the lens I just bought. An answer ASAP will be greatly appreciated!
I am gonna go ahead and guess that both the first two guys just randomly said yes and no because they wanted to get their quick few points, but to answer the question, it will work. All of Nikon's consumer digital SLR's will take the same lens mounts. It is just what features they can use on them (like auto focus). Most companies, like canon, stick with this policy, because it makes upgrading so much easier.
Just to rest your mind though, here is some information right off of their site.
"All Nikon AF-S/AF-I Nikkor lenses work seamlessly with the D40, and all Nikon lenses feature the finest optics and precision mechanisms to provides optimized performance for sharp, consistent results (Autofocus is supported only with AF-S and AF-I CPU lenses, which are equipped with an autofocus motor). The camera includes the 18-55mm f/3.5-5.6G ED II AF-S DX Zoom-Nikkor Lens which was designed exclusively for use with Nikon DX-format digital SLRs. This ultra-compact 3x zoom offers Nikkor sharpness and versatility in a wide variety of shooting situations."

No
References :