Page 1 of 1
About Question enthuware.ocajp.i.v7.2.1128 :
Posted: Sun Oct 12, 2014 5:32 am
by Daniel Clinton
Hi Paul,
Just a tiny but hopefully

useful thought I had about the question.
As it stands, both logical && and bitwise & will produce the same result.
If i++ were tested for equality with an int other than 0
it would bring the second concept in the explanation into play.
Re: About Question enthuware.ocajp.i.v7.2.1128 :
Posted: Sun Oct 12, 2014 6:26 am
by admin
Daniel Clinton wrote:Hi Paul,
Just a tiny but hopefully

useful thought I had about the question.
As it stands, both logical && and bitwise & will produce the same result.
In this particular case, yes.
If i++ were tested for equality with an int other than 0
it would bring the second concept in the explanation into play.
Not sure what you mean. Can you write it in code so that it is clear what you mean?
-Paul.
Re: About Question enthuware.ocajp.i.v7.2.1128 :
Posted: Tue Oct 14, 2014 6:59 am
by Daniel Clinton
Hmmm, I'm splitting hairs really and my confidence in the idea is waning but...
my thought was to try to add something the question by having the first expression evaluate as false like:
Code: Select all
int i = 0;
int j = 1;
if ((i++ == 1) & (j++ == 2)) {
i = 12;
}
(to test if the answerer spots the single & operator)
Re: About Question enthuware.ocajp.i.v7.2.1128 :
Posted: Tue Oct 14, 2014 8:09 am
by admin
You got it right. That would make the question tougher. I think that is covered in some other question though. Not every question needs to hit all the gotchas
