All I can see is that the value of x never changes. I can't tell that it's always zero because, for example, the value of x passed to the method might be 42. But we don't see any code like that.
However... even if you and I could see that the value of x is zero and never changes, the compiler can't see that. The compiler isn't a programmer and it doesn't attempt to analyze code except in the most trivial ways, and those ways are specified in the JLS. For the exam
you should certainly familiarize yourself with the ways that the compiler deems code unreachable, though. There's only a few of them.