As you see || is a short circuit operator.
So it first it
test first condition and if it found it true it didn't execute next one which is the case here.
In ++z>5 ,z first incremented and then compared so it becomes
6>5 which is true and the controls comes to z++ which increment z to 7 and return it.
If you print z like this System.out.print(z) //z=7
If you print z like this System.out.print(z++) //z=6