File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Spring in Action
this week in the
Programmer Certification (SCJP/OCPJP)
double question in srinivas majji's mock exam
Joined: Aug 16, 2005
Aug 16, 2005 14:00:00
can you please let me know why the answer B is correc. iknow that min is -0.0,max is 0.0.but i'm not sure sbout the Math.min-0.0,+0.0)== Math.max(0.0,+0.0));
can sombody help with this question.
public void check()
5: System.out.println(Math.min(-0.0,+0.0) == Math.max(0.0,+0.0));
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.
B is correct answer in Srinivas Majji's mockexam
Joined: May 20, 2005
Aug 16, 2005 14:11:00
Negative zero compares equal to regular zero (positive zero), but the two zeros may be distinguished by division: one divided by negative zero yields negative infinity; one divided by positive zero yields positive infinity.
I agree. Here's the link:
subject: double question in srinivas majji's mock exam
-0.0 == 0.0 ? help
A question from Mock
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014