Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
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
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Math.abs()method" Watch "Math.abs()method" New topic
Author

Math.abs()method

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
Sheriff

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
sscce.org
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Math.abs()method