Originally posted by Campbell Ritchie: Jesper Young is correct.
There is no point confusing things by changing < to >=, you have to stick with what the question said. Not as if you had actually got the < and >= the right way round.
I don't agree. Jesper certainly is correct (!(x < y) is not the same as (y < x)). But there's no correct answer in the given list. > is always oposite to <= [ December 29, 2007: Message edited by: Roberto Perillo ]
Joined: Oct 23, 2007
Thanks to you all My personell view is Jesper Young is right.He has given a correct explanation.
I also think that B and C are the right answers. Look at if statement and what it tells us? Get max. Isn't it?
a) min b) z=x<y ?y :x is z=y>x ?y :x -it means get max c)the same as b d)min
A dreamer is one step behind the achiever, and the achiever was once a dreamer.
Joined: Oct 12, 2007
Another idea... with if x=y... in b we would get z=x not z=y like at if. But what is the difference... only if x and y are objects not primitives. But here we have > = operators... who knows may be x and y objects of Integer [ December 29, 2007: Message edited by: Dale Carnegie ]
Both options b and c are correct. Case 1: x!=y,x<y, x=4, y=5, then z=5, using both b and c. Case 2: x!=y, x>y, x=6,y=5, then z=6, using both b and c. Case 3: x=y, x=5,y=5, then z=5, using both b and c.
Joined: Oct 12, 2007
b is not correct because:
Integer a,b; a = 777; b = 777;
//(a == b) false // a.equals(b) true
z1=a; z2=b; //(z1 == z2) false
So z will have a reference to another object not like at the if statement.
Yes partners, I read and reread carefully the question. I got it the wrong way around, that's right, Jesper... sorry I read the question too quickly at the first time... the essence of this exercise is to know what is the same to x < y, not what is oposite to x < y... correct, x < y is the same as y > x... in this case, the only correct answer is indeed letter (C)... Thanks Jesper, you got everything cleared, man.
Good evening, everyone... and happy new year!!! [ December 30, 2007: Message edited by: Roberto Perillo ]