Page 1 of 1

About Question enthuware.ocajp.i.v7.2.982 :

Posted: Wed May 06, 2015 6:21 am
by subhamsdalmia
{ flag = true; loop = 0; }
flag is not static and so it can be accessed only from a non-static block. loop is static so can be accessed from any block.
but loop is private as well,
so when we say any, it means method of same class?

Re: About Question enthuware.ocajp.i.v7.2.982 :

Posted: Wed May 06, 2015 7:02 am
by admin
Here, it is talking about static and non-static blocks.
But yes, static variable can be access from anywhere within a class.

You should try writing some code to try it out.