I have been working with Java since 1997 and after all that time I thought I new Java. I also managed to earn few Java certifications. So I was quite confident I could cut good code that would run as expected.
That was until I read Java Puzzlers written by Joshua Bloch and Neal Gafter. Boy, I was wrong! There were so many examples of Java code that I expected to produce different results. I strongly recommend reading this book. It will give you an insight into the core of Java classes, objects, primitive types, libraries, and more...
Serious geek fun!
Moreover I recently visited Javalobby website and found an interactive Yet More Java Puzzlers talk slideshow that illustrates eight more Java puzzlers that were presented on JavaPolis 2005 conference.