This week's book giveaway is in the JDBC forum.
We're giving away four copies of Make it so: Java DB Connections & Transactions and have Marcho Behler on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Math.abs()method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Math.abs()method" Watch "Math.abs()method" New topic


shanthisri mocherla
Ranch Hand

Joined: Sep 05, 2005
Posts: 119
HI guys

here is my code

I thought the answers 2 and 3 are correct as Integer.MIN_VALUE is eqaul to Integer.MAX_VALUe+1.
As Math.abs(Integer.MIN_VALUE) returns Integer.MIN_VALUE.
But the answer given is 2.

Thanks in advance
marc weber

Joined: Aug 31, 2004
Posts: 11343

I think that answer 3 is meant to imply an integer (not bit) representation that is one more than Integer.MAX_VALUE without overflow. In other words, a large positive value beyond the range of an int.

(Answer 2 is correct.)
[ September 08, 2005: Message edited by: marc weber ]

"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
I agree. Here's the link:
subject: Math.abs()method
It's not a secret anymore!