You can find the post over here.
The 'trick' involves a static initialiser to print the String, and then calling an explicit exit().
Nice work in using Google's syntaxhighlighter on the code, very pretty.
I'd happy if anyone could point out a real-world application of the code shown, or a reason that knowing this 'trick' makes you a better developer.
The two main points that grate are
- the use of System.exit(), which either makes it non-portable, or crashes the code it gets attached to
- The fact that it fails to initialise the Class, which would result in (if memory serves) a ClassNotFoundException when accessed from that point on.
Agreed that these points are only meaningful if you use the code in conjunction with other code, but then again explain the use of code that cannot be used?
Comments[2]
Posted by davo on 27 July 2008 10:15:56

