Walter Williams wrote:One would think you could declare static variables inside a static initialization block (int myNum = -1;) and have it be static or global.
While the creators of Javacould have made it work that way, they didn't. If you declare a variable in a code block or method, it's only going to be local to that block or method. In order to have a wider scope, it would need to be outside a block, but inside a class - either static or non-static.
A static initialization block is good for doing something upon class loading. It isn't useful for declaring something.