An x ray will determine if your problem is arthritis. Remember it doesn't happen to just old people. And it will hurt all the way up to the buttocks if the knee is bone on bone. - A cortizone shot usually brings relief. You are young enough that the doctor may recommend surgery.
Its very strange bc I had the same issue and for 6 months docs told me I had tendonitis. By the 5th month I couldnt deal with it anymore (mine happened suddenly also) I finally went to an orthopedic doc who told me I had a meniscus tear in my knee & a plica band (scar tissue from sports in my teens) I asked why did my thigh hurt bc that had nothing to do at all with my knee. He explained that with soft tissue like a tear (esp this kind bc there is little blood flow for healing) around the knee in the spot mine was, effects the tendons and blood flow which was irritating to my thigh...so times my thigh would hurt worse. I ended up having surgery bc there was no way it would heal on its own. Ice and some type of NSAID (ibprohen 800mg help me most) will be your best friend. Im 27 & got the surgery 2 yrs ago. Its just wear and tear and sometimes just nealing can cause it. But thats all I know from my experience..are you having pain laying/sleeping/walking..or all the above?
If the pain is on the top and outer thigh and causes numbness and pins and needle sensations running down to the knee, this is a trapped nerve in the groin area and is called meralgia parasthetica. If you are overweight, the answer is to lose weight because this puts pressure on the nerves.
If find my condition worsens when I am walking or standing and only gets better when lying down.
Knee pain can be bone problems like osteoarthritis or other forms of arthritis, as well as from tendon and other soft tissue damage.
Your doctor should be able to give you a correct diagnosis.