Philipp wrote On 04/12/07 12:43,:
> Hello
> I've been looking around the apache Harmony java files and found a
[quoted text clipped - 15 lines]
> What's this "static" without a name or identifier? How is it used?
> What's it for?
Look up "static initializer" or "static initialization
block" in your Java textbook. In the snippet you've shown,
the code inside the { } will be executed once, during the
initialization of the class.

Signature
Eric.Sosman@sun.com
Martijn - 12 Apr 2007 18:38 GMT
> Philipp wrote On 04/12/07 12:43,:
>> public class JPEGImageWriter extends ImageWriter {
[quoted text clipped - 15 lines]
> the code inside the { } will be executed once, during the
> initialization of the class.
This way you can have static objects, but still have the opportunity to
properly initialize them without special constructs like factories and the
sorts.

Signature
Martijn
http://www.sereneconcepts.nl
Mark Space - 12 Apr 2007 18:56 GMT
> Look up "static initializer" or "static initialization
> block" in your Java textbook. In the snippet you've shown,
> the code inside the { } will be executed once, during the
> initialization of the class.
In Java parlance, "initialization" means when the class is loaded by the
classloader.
> public class JPEGImageWriter extends ImageWriter {
> //ctor and member vars are here
[quoted text clipped - 9 lines]
> What's this "static" without a name or identifier? How is it used?
> What's it for?
See http://java.sun.com/docs/books/tutorial/java/javaOO/initial.html
- Oliver
Philipp <sicsicsic@freesurf.ch> wrote in news:1176396236_1015
@sicinfo3.epfl.ch:
> What's this "static" without a name or identifier? How is it used?
> What's it for?
It is a static initializer for the class.
c.f. <http://www.developer.com/java/other/article.php/2238491>
Cheers!

Signature
---------------------------------------------------------------------
Greg R. Broderick gregb+usenet200612@blackholio.dyndns.org
A. Top posters.
Q. What is the most annoying thing on Usenet?
---------------------------------------------------------------------