Monday, March 21, 2011

Java 的instance initializer

http://www.c2.com/cgi/wiki?DoubleBraceInitialization
http://java.sun.com/docs/books/jls/third_edition/html/classes.html#8.6

原來Java除了 static initializer 之外
還有 instance initializer

不過這方法很少用到
因為其實constructor 就可以了

不過在Anonymous inner class時
因為他們沒有 constructor
這時就可以用 這instance initializer 來達到同樣的功能了

1 comment:

Anonymous said...

Hey I know this is off topic but I was wondering if you knew of any widgets I could add to my blog
that automatically tweet my newest twitter updates. I've been looking for a plug-in like this for quite some time and was hoping maybe you would have some experience with something like this. Please let me know if you run into anything. I truly enjoy reading your blog and I look forward to your new updates.

Here is my web page new cellulite treatment