Thanks for the question! From what you're describing, it seems that your knee hurts with full straightening (extension) and also full bending (flexion). This symptom of pain at the extremes of knee motion can be from a simple sprain to the knee or from a long-term problem like degenerative joint disease.
If you've had a recent knee injury (like a twist or fall) and can relate your current problems to that injury, then a visit to your PCP or an orthopedic specialist is warranted. This is especially true if significant swelling accompanies your pain symptoms or if your discomfort has not resolved with rest and icing or simple over-the-counter pain relievers.
On the other hand, knee pain that has been going on for months or years without a specific injury, and is more of an ache in the knee, may be related to arthritis.
Although arthritis is seen commonly in the 60s-and-over age group, it is not uncommon for me to see early arthritis in patients in their 30s and 40s. The "old football injury" can cause arthritis symptoms many years down the line.
The diagnosis of is made easily with a simple knee x-ray coupled with the patient's history. The common complaints include stiffness, pain in full knee flexion or extension, swelling and a general ache in the joint.
Treatment is initially aimed at relieving the pain and increasing the motion in the knee -- sometimes with medications, physical therapy, or even injections. Surgery is always the last option for this problem.
In summary, the symptom of knee pain in full flexion or extension of the knee has many possible causes. A visit to your PCP or orthopedic surgeon will help to finalize your diagnosis.