tag:blogger.com,1999:blog-8705625483014737246.post2058324097446350332..comments2023-06-08T05:29:08.921-04:00Comments on Mind Like a Sword: Mini Java puzzler - Zapped by staticBurk Hufnagelhttp://www.blogger.com/profile/15187489386500158298noreply@blogger.comBlogger6125tag:blogger.com,1999:blog-8705625483014737246.post-75507044197261542332009-03-22T21:49:00.000-04:002009-03-22T21:49:00.000-04:00dovwas,Thanks for the question, it got me to do th...dovwas,<BR/>Thanks for the question, it got me to do the legwork to find out what's supposed to be going on so I could give you an authoritative answer.<BR/><BR/>Chapter 12 of the Java Language Specification (3rd edition), covers "Execution" and section 4 looks at the initialization process. The 5th paragraph of section 12.4.1 says, "The static initializers and class variable initializers are Burk Hufnagelhttps://www.blogger.com/profile/15187489386500158298noreply@blogger.comtag:blogger.com,1999:blog-8705625483014737246.post-73966163607545846242009-03-20T02:18:00.000-04:002009-03-20T02:18:00.000-04:00So can we conclude that member variable initializa...So can we conclude that member variable initializations behave as if they were static (or instance) block initializers, running in the same sequence as the explicit initialization blocks? That would explain the behavior you demonstrated.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8705625483014737246.post-80372664848035764882009-03-18T03:12:00.000-04:002009-03-18T03:12:00.000-04:00Anonymous:I'M glad to see YOU'RE making progress l...Anonymous:<BR/><BR/>I'M glad to see YOU'RE making progress learning English. Post a comment when you have 10 more YEARS' experience.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8705625483014737246.post-77064756477103516102009-03-17T22:20:00.000-04:002009-03-17T22:20:00.000-04:00Im glad to see your making progress learning java....Im glad to see your making progress learning java. Post an article when you have 10 more years experience.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8705625483014737246.post-63348686822489782282009-03-17T10:49:00.000-04:002009-03-17T10:49:00.000-04:00Andy,Very interesting. I hadn't thought to try it ...Andy,<BR/>Very interesting. I hadn't thought to try it in Groovy but now you've got me wondering...<BR/><BR/>Thanks for the comment,<BR/>BurkBurk Hufnagelhttps://www.blogger.com/profile/15187489386500158298noreply@blogger.comtag:blogger.com,1999:blog-8705625483014737246.post-36824237535408293652009-03-17T07:09:00.000-04:002009-03-17T07:09:00.000-04:00But if you run it in the GroovyConsole it outputs....But if you run it in the GroovyConsole it outputs... My name is Bond, James Bond. I wonder how many people have ported their Java code to Groovy and now it's acting strangely.Anonymousnoreply@blogger.com