Having reflected on his sentence, the prisoner draws the conclusion that he will escape from the hanging. His reasoning is in several parts. He begins by concluding that if the hanging were on Friday then it would not be a surprise, since he would know by Thursday night that he was to be hanged the following day, as it would be the only day left. Since the judge's sentence stipulated that the hanging would be a surprise to him, he concludes it cannot occur on Friday.
He then reasons that the hanging cannot be on Thursday either, because that day would also not be a surprise. On Wednesday night he would know that, with two days left (one of which he already knows cannot be execution day), the hanging should be expected on the following day.
By similar reasoning he concludes that the hanging can also not occur on Wednesday, Tuesday or Monday. Joyfully he retires to his cell confident that the hanging will not occur at all.
The next week, the executioner knocks on the prisoner's door at noon on Wednesday — an utter surprise to him. Everything the judge said has come true.