It really depends on what you are worried about with your knees. If it's impact, use some good knee pads. On the other hand, if it's your ligaments in your knee, get to the gym.
The key to healthy knees is strong quads and hamstrings. Flexibility in your hamstrings is really helpful too. Do squats, lunges, step ups, box jumps, jump tucks, hamstring curls. Exercises that will strengthen your legs, will help save your knees.