Just to add to what Jeff says, that code gets called whenever an
instance of that class is created, before any constructor is called,
and operates on the instance being constructed. Generally not very
widely used except in anonymous inner classes.
Jeff Mutonho wrote:
> On 12/12/06, IanF <[EMAIL PROTECTED]> wrote:
> >
> > Hi
> >
> > I came across some strange behavour re. the static intializers in
> > JDK1.5 and cant find any reference to this in the api docs.
> >
> > the 'static' keyword become optional for static initializers.
> >
> > in JDK1.4
> >
> > static {
> > ... do some static stuff...
> > }
> >
> > in JDK 1.5 this seem perfectly valid ( even put breakpoint and stepped
> > into)
> >
> > {
> > ... do some static stuff...
> > }
> >
> > Is this true or is there a different meaning to this???
> >
> >
>
> Naah...what you have there is NOT static initializer , but an
> instance initializer (Section 8.6 of the spec)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CTJUG Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/CTJUG-Forum
For the ctjug home page see http://www.ctjug.org.za
-~----------~----~----~----~------~----~------~--~---