Are variables declared inside a static block accessible anywhere else?
What “kind” of member are they(ie., are they static member, too?)
Are variables declared inside a static block accessible anywhere else? What kind of member
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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