Cameras adjust the exposure in two main ways. They use shutter speed to control how long the sensor is exposed to light, and the lens aperture to control the light intensity.
If you use Program mode (P on your Nikon’s mode dial), the camera will adjust both criteria itself, according to the conditions and the type of subject. As well as this fully automatic mode, there are two semi-automatic modes. If you need to set a