About Question com.enthuware.ets.scjp.v6.2.336 :

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

Moderator: admin

Post Reply
milskruger
Posts: 4
Joined: Sun Oct 26, 2014 6:33 am
Contact:

About Question com.enthuware.ets.scjp.v6.2.336 :

Post by milskruger »

Hi,

I'm having trouble understanding why A is correct.
If we look at A, and we first do the mathematical equation before printing, then why is B wrong?

Thanks for the help.

M

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

Re: About Question com.enthuware.ets.scjp.v6.2.336 :

Post by admin »

Explanation to option 1 says + is left associative. It does not say that mathematical equation has to be done first.
Since + is left associative, option 2 is incorrect.
This explains what is meant by associativity: http://en.wikipedia.org/wiki/Operator_associativity
Once you read the above link, it will be clear.

HTH,
Paul.
If you like our products and services, please help us by posting your review here.

milskruger
Posts: 4
Joined: Sun Oct 26, 2014 6:33 am
Contact:

Re: About Question com.enthuware.ets.scjp.v6.2.336 :

Post by milskruger »

Thanks Paul!

Post Reply

Who is online

Users browsing this forum: No registered users and 58 guests