Monday, November 1, 2010

Java Annotations pt 2

This is my second entry about this topic. This one is a simple example how to implement a singleton pattern without have to code it, just annotate the class.

Let's make our annotation.



Just for test, we will create a simple class.



And now the brains!



Our main class goes like this.



Let's test this!

Output:
test
21171036
test
21171036

Boom!