Myopic eyes can still focus on nearby images as the lens needs to relax a bit more than in a normally-sighted person. However, objects far away cannot be focused, because in a complete relaxed state (for distant objects), the lens focuses the image in front of the retina. Hyperopic eyes cannot focus on nearby objects as, at a certain close distance, the lens reaches maximum accomodation (maximum roundness) and objects cannot be focused any longer.
Myopia or near-sightedness is a condition of the eye where the light that comes in does not directly focus on the retina but in front of it, causing the image that one sees when looking at a distant object to be out of focus, but in focus when looking at a close object. Often the eye ball is too long, or the cornea has too much curvature (Web MD).
Hyperopia ("over-measured sight") or farsightedness, is a defect of vision caused typically by the eyeball being too short, or a lens that cannot accomodate/become round enough. It causes difficulty focusing on near objects (wikipedia).