Quick, what’s the output of this code snippet?
int x = 32;
// this is a comment \u000a x++;
System.out.println(x);
Since you’re reading this, you probably figure it’s a trick question and the answer is not 32. And you’d be correct. The answer is 33.
The \u000a
that probably caught your eye is a unicode newline character. So the editor doesn’t break the line, but the JDK does.
Want to give it a try?
int x = 32;
// this is a comment \u000a x++;
System.out.println(x);
>
Not sure what other kind of fun you could have with this, but it’s good for contest problems.
CompSci.rocks Newsletter
Want to stay in touch and keep up to date with the latest posts @ CompSci.rocks?