Two Laptop Bag*
The moose likes Mock Exam Errata and the fly likes majji's question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Mock Exam Errata
Bookmark "majji Watch "majji New topic

majji's question

Malli Murugan

Joined: Jul 09, 2001
Posts: 12
System.out.println(Math.min(-0.0,+0.0) == Math.max(0.0,+0.0));
The answer is true;
Jane Griscti
Ranch Hand

Joined: Aug 30, 2000
Posts: 3141
Hi Malli,
The == operator treats +0.0 and -0.0 as 0.0, it doesn't recognize the difference. See JLS §15.21.1
Hope that helps.
Jane Griscti
Sun Certified Programmer for the Java� 2 Platform

Jane Griscti
SCJP, Co-author Mike Meyers' Java 2 Certification Passport
Malli Murugan

Joined: Jul 09, 2001
Posts: 12
Thanks Jane.
I agree. Here's the link:
subject: majji's question
Similar Threads
what s the result
-0.0 is what makes java very different :)
SCJP doubt
what this code returns true
Math min,max