Hello,
There is a typo in the explanation:
1. i = ++j; is not same as i = j++; In the case of i = ++j, j is first incremented and then compared with i. While in the case of i = j++;, j is first compared with i and then incremented.
I think, that '=' should be changed to '==', at least because of the text: '... and then compared...'.
However, I think, that the explanation is a bit vague, I mean, probably this is not the explanation for this question, because there is no 'i = ++j' or similar in the question.
Probably this would be a better explanation:
1. i++ == 0 is not the same as ++i == 0. In case of i++ == 0, i is compared first with zero, then incremented. While in the case of ++i == 0, i first incremented, then the incremented value is compared with zero.
About Question com.enthuware.ets.scjp.v6.2.286 :
Moderators: Site Manager, fjwalraven
-
- Posts: 11
- Joined: Sat Mar 08, 2014 1:20 am
- Contact:
-
- Site Admin
- Posts: 10384
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question com.enthuware.ets.scjp.v6.2.286 :
You are right. Explanation has now been improved.
thank you for your feedback!
thank you for your feedback!
Who is online
Users browsing this forum: No registered users and 10 guests