Why would we not use a for loop, I wonder?
Also, we should write something out if `msg==null` rather than just exiting.
And I'd change it to `System.out.printf("Got message %d: '%s'\n", n+1, msg.getText());` - assuming it's a for loop, where we're count up from 0.