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

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
subhamsdalmia
Posts: 32
Joined: Sat May 02, 2015 11:57 pm
Contact:

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

Post 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?

Online
admin
Site Admin
Posts: 10388
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post 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.

Post Reply

Who is online

Users browsing this forum: admin and 6 guests