The human eye can focus on objects at different distances by adjusting the focal length of the eye lens. This is due to:
The eye has the ability to change its focus from distant to near objects (and vice versa) by changing the shape of the lens.
The process of adjusting the focal length of a lens to keep an object in focus on the retina as its distance from the eye varies is called the accommodation of the eye.