On more advanced digital cameras, especially on dSLRs, you can check your exposure by using the histogram.
Note: Showing the histogram on the different cameras is done different ways - please refer to your user's manual to find out how its done on your particular camera.
Once you see the histogram, you can either adjust your aperture and/or shutter speed, or the exposure compensation to bring the histogram into line. (Again, refer to your user's manual to find out how to do this if you don't already know.) The right side of the histogram chart is the "highlight" side. The left side is the "shadow" side.
This is properly exposed image:
To make sure you have as much highlight detail as possible, the histogram bars should be as close to the right side (highlight side) of the histogram as possible without blocking up like this overexposed image:
If the image is underexposed like the image below, it can be rescued by lightening it in your editing program, but generally will gain noise (similar to grain in film photography.)
Which brings us to the concept of "Expose To The Right"
With digital cameras, many photographers are using an exposure method called "Expose to the right" or ETTR.
In the "Using the Histogram on digital cameras" section, you would have learned about keeping the histogram centered and not "blocking up" on either side.
With ETTR you would keep the histogram as far to the right as it can get without blocking up. This makes the image as bright as possible without going too far.
One of the effects of having too low an exposure on digital cameras is that it creates noise (random pixels) - especially in the shadow areas.
To use the ETTR method, make sure there is no gap to the right side of the histogram and that it is not "piled up" on the right.