{ 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?
About Question enthuware.ocajp.i.v7.2.982 :
Moderator: admin
-
- Posts: 32
- Joined: Sat May 02, 2015 11:57 pm
- Contact:
Online
-
- Site Admin
- Posts: 10388
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.982 :
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.
But yes, static variable can be access from anywhere within a class.
You should try writing some code to try it out.
Who is online
Users browsing this forum: admin and 2 guests