On my second iPhone 3G. On my first iPhone, the volume down button was making a weird clicking noise. Returned it. The battery on that phone worked much better after a few days compared to my current, brand new iPhone. I am confident I will have similar success after a few days, though. Both phones are going through the exact same initial charging methods.
Here is the method I'm going to use while charging my iPhone. Very detailed, possibly a little extreme, but in the long run you'll be happy

.
#1 - Buy iPhone
#2 - Initially charge iPhone for 8 hours (don't flame, I know what you're going to say). Use your wall charger (avoid computer charger).
#3 - On first use, let the iPhone's battery fully drain out.
#4 - Next, fully charge your iPhone overnight.
#5 - From this point forward, DO NOT LET YOUR BATTERY DRAIN COMPLETELY. Recharge your iPhone w/ 40 % or more battery life (using wall charger or car charger).
#6 - Once a month, make sure you fully charge your iPhone and fully drain the battery in one motion.
#7 - Always charge with the iPhone out of it's case. Charging your iPhone inside your case will make the iPhone hotter. This is what happens to hot batteries:
#8 - Store your iPhone in a cool location (near fan or AC) at night. The colder the location, the longer your battery will last. DO NOT PUT PUT YOUR IPHONE IN THE FREEZER! LOL.
#9 - If you ever need to store you iPhone for any reason, make sure your battery is stored @ 40% charge. Never store your phone fully charged or depleted
More information can be found here, as it's a great place to begin to learn about your iPhone battery:
http://www.batteryuniversity.com/parttwo-34.htm
http://www.apple.com/batteries/iphone.html
As for defective batteries. First and foremost, charge from the wall. I tried charging my iPhone from my iMac and had a 20% charge the next morning. I'm not saying you can't successfully charge from your computer, but to diagnose a problem, I would give the wall charger a shot. If you use the wall charger, reset your iPhone, fully charge the battery, fully drain the battery, then fully charge the battery. After those steps are done and your iPhone STILL can't hold a charge, I would take it into the Apple store to get a replacement.