Have you dropped it and damaged the sensor? i take you can see out of the viewfinder (The d3100 is a SLR is it not? My memory fails me)
Several DSLR's can fail to set lighting correctly when your eye is not by the viewfinder, as light can enter though it and mess with the metering settings.
What mode do you have it on, auto? Programed, Manual?
if it is on something like manual/aprature priority/shutter priority make sure the setting you have applied are not too fast for the lighting in the scene.
Check it is all working by going onto manual, setting the F-Stop to as low as you can (2-5 ideally) and increase the shutter speed to something around 5 seconds than point the camera directly at a bright light (Not the sun as it may burn the sensor :D) if the image does not come out ridiculous white your sensor is probably borked.
If it does come out white, but comes out black in most normal shots it could be you have broken a element in the lens, this can cause it to be dispersed in a unwanted manner and not hit the sensor, remove the lense , look though the shutter side and point towards some decent source of light, you should be able to see it reassembly well :P Or just visually inspect for any cracks
Hope this can help :D