Bookmark Topic Watch Topic
  • New Topic

weird static block  RSS feed

 
Yuan Ye
Ranch Hand
Posts: 172
  • Mark post as helpful
  • send pies
  • Report post to moderator
There is a weird case in static block initialization with a static variable. It seems you can put the static block before the declaration, since the following code works! but why?



To make things more weird, the following code won't work! You can't refer the static variable. Error message: "illegal forward reference". Why?

 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please don't post duplicate messages -- it just wastes people's time. I'm closing this one and leaving this other one open.
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!