Ahh no i see .... it does print 1 and 2 because the condition is that m++ is less than 2 ...
so first time round the loop :
m = 0;
while (m++ < 2) //m is counted as 0 then incremented
System.out.println (m) // m == 1
then next time round
while ( m++ < 2 ) // m is = 1 then incremented
System.out.println (m) // m == 2
oooh I can imagine this being a common trap in the exam!
Pounding at a thick stone wall won't move it, sometimes, you need to step back to see the way around.