taller than any student or taller than any other student
Is John a student? If so, the second sentences in both cases are correct. In the first ones John could just as well be the professor.
I would suggest another sentence if at all possible:
John is the tallest student in his class.