Can nearsightedness be corrected by looking at a distance a lot?

No. Near and far-sightedness is due to the shape of your eye. You can perform eye exercises to help strengthen your focusing ability.