Static variables are initialized and static block is executed at class load time, which occurs either when the first object of that class is created or when a static member of the class is accessed (even if no object is created). If an object is being created, then instance variables are initialized and non-static initializer block is executed. After this, the body of the constructor executes.
However, as Emilio pointed out, your int b is local to the block. If you want it accessible as a class variable, then you need to declare it as static outside of that block, even if you're going to initialize it using a static block.
( Barry change static b; to static int b; )
[ September 10, 2004: Message edited by: Barry Gaunt ]
Thanks, Barry... [ September 10, 2004: Message edited by: marc weber ]
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer sscce.org
Don't touch me. And dont' touch this tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user