One Two Three One Two Three - 3 years ago 165
Java Question

What is the scope of variables declared inside a static block in java?

Are variables declared inside a static block accessible anywhere else?
What "kind" of member are they(ie., are they static member, too?)

Answer Source

Generally programmers don't need to declare any variables inside static blocks, usually this is only for ensuring initialization of static variables for use by all instances of class (depending on scope of static variable).

Variables declared inside a static block will be local to that block just like methods and constructors variables.

JDK Docs

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download