There have been lots of threads about hips and knees recently - especially from pompa and me! (New knee in April, new hip 17th December)
Exercise is vital, and even more so before and after these operations. But it is better to be taking regular exercise regularly, obviously - that is a well known fact. Even when one is on pain, as I am, there are exercises with which one can cope, or which one can adapt. After all, there is a cardio vascular system to be kept healthy.