Implementation code inside interfaces

Someone at work told me about this java newsletter: The Java Specialists’ Newsletter . I am trying to catch up with some old issues. It is verry interesting though the issue linked contains code that is trying to deadlock my brain.

Now to the trick of the week, which is something you should never need to do. Please avoid doing this under all circumstances, because there are much better places to put method code than in interfaces, but I want to show you what is possible with inner classes.

[ some really scary code here ]

Try and understand what is happening in the code, because it will teach you something about inner classes and how the callback mechanism works.

Go read some of the issues!

Some Quotes:

[…] that Java was not based only on C++ and Smalltalk, but also on Lisp ?!? (I did not know that, no wonder it’s so terribly slow. I’m surprised the JDK doesn’t come with the Emacs editor.)

[…] If you use this commercially please do the exception handling correctly, I didn’t bother in my example, in preparation for when I change my logo to “The C# Specialists”.