If you are having knee pain and want to strengthen your legs, here is a video of what to do. Notice that you want to make the bend very short so as not to strain the knee... about 15% angle. Although this video talks about a 5 second hold when the knee is straight, I suggest 9 seconds, and 8 reps at least. If you can do more than 9 reps, you should add weight.
As a result, I put on a lot of muscle in about 3 months time. I stopped also eating sweets but my weight is still up. The last thing, I believe, that is holding me back from dunking is my weight. I am going to come up with a plan and challenge to do just that, soon!