posted 8 years ago

Dear All,

I encountered the following question while attempting a practice test in http://examprep.whizlabs.com

The answer given was:

Is this correct?

Of course C is correct; but if B is correct the case when x == y will make z = x; where as in the given code z = y for the same case right?

I thought the question was an easy one; but now confused Please help!

I encountered the following question while attempting a practice test in http://examprep.whizlabs.com

The answer given was:

**Choices B and C are the correct answers.**Is this correct?

Of course C is correct; but if B is correct the case when x == y will make z = x; where as in the given code z = y for the same case right?

I thought the question was an easy one; but now confused Please help!

SCJP, SCWCD, SCBCD

Jhakda Velu

Ranch Hand

Posts: 167

posted 8 years ago

x=1

y=1

taking option b

the end result is still the same

whether z=x or z=y, both the answers will be the same,right?

Jhakda

y=1

taking option b

the end result is still the same

whether z=x or z=y, both the answers will be the same,right?

Jhakda

If I become filthy rich, I'll sponsor research for painless dental treatment at Harvard Medical School. Thats why,I'm learning Java.I have 32 teeth, 22 are man made.

Prabz Bhatia

Greenhorn

Posts: 19