Another simple Java puzzle. Does the following code compile? If so, what does it do when you run it? public class Unicode { public static void main(String[] args) { System.out.println(“\uuuuuuuuuuuuuuuu0055″); } } Answer: Show ▼ It prints “U”. Unicode literals in Java are usually of the form \uxxxx, where xxxx is the hexadecimal form of […]
All posts tagged puzzle
Java puzzle 2: Extra long Unicode literals
Posted by Simon on May 8, 2010
https://nickerson.org.uk/blog/2010/java-puzzle-2-extra-long-unicode-literals/
Java puzzle 1: fun with Loggers
I’ve been a fan of Java Puzzlers by Joshua Bloch and Neal Gafter since a colleague lent me a copy about a year ago. Every now and again, I come across weird things in Java that I think would make a good puzzle. In the spirit of Java Puzzlers, consider the following piece of code. […]
Posted by Simon on April 8, 2010
https://nickerson.org.uk/blog/2010/java-puzzle-1-fun-with-loggers/