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

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

Moderator: admin

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

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

Post by admin »

Yes, static methods work the same way.
If you like our products and services, please help us by posting your review here.

baichen7788
Posts: 23
Joined: Fri Mar 26, 2021 7:25 am
Contact:

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

Post by baichen7788 »

Even though I chose the correct option, I could not understand why j=30.
j=30 makes no sense.
Is j initialised in static block or outside of static block?

If j is initialised in the static block, then j=100 should be the answer because instance variable is executed after static block.
If j is initialised outside of static block with j=100, then static block is executed after the instance variable initialisation, which is contradiction with the rule.

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

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

Post by admin »

j is an instance field. Why do you think it might be initialized in a static block? No where in the given code is j accessed in a static block!

You might want to go through the code again more carefully.
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 2 guests