Any exercise is good for your knees so yes an exercise bike would help you if you have bad knees.
Regular exercise is a requirement if you want to live a long healthy active life.
To keep from becoming bedridden or immobile in old age you have to keep moving.
As the saying goes a body in motion stays in motion.