Prasad has done an excellent job of outlining what happens, however I had to go through it myself in order to fully grasp what is going on and I have tried to simplify, or at least re structure the comments, and re-implement the code, with more verbose naming conventions, for my peace of mind, to try to follow the logic. If it may help I've posted my version here. Anyone feel free to correct me or comment if I have got it wrong. My comments try to show my understanding of whats going on.
be a well encapsulated person, don't expose your privates, unless you public void getWife()!