posted 15 years ago
1: public void check()

2: {

3: System.out.println(Math.min(-0.0,+0.0));

4: System.out.println(Math.max(-0.0,+0.0));

5: System.out.println(Math.min(-0.0,+0.0) == Math.max(0.0,+0.0));

6: }

A) prints -0.0, +0.0 and false.

B) prints -0.0, +0.0 and true.

C) prints 0.0, 0.0 and false.

D) prints 0.0, 0.0 and true.

The correct answer is A.

How come System.out.println(Math.min(-0.0,+0.0) == Math.max(0.0,+0.0)) is true. I thought it is false because Math.min(-0.0,+0.0) is -0.0 and Math.max(0.0,+0.0)) is 0.0.

Thanx in adv