wood burning stoves 2.0
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes 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 "abs( ) method" Watch "abs( ) method" New topic

abs( ) method

k j goban

Joined: Feb 01, 2001
Posts: 1
what will be the o/p for the following and why
pls give me the explanation.
class Test
public static void main(String[] args)
with rgds
Anshuman Acharya
Ranch Hand

Joined: Jan 19, 2001
Posts: 144
Integer.MIN_VALUE = -2147483648
Integer.MAX_VALUE = 2147483647
hence the abs of min-value is out of the range of the int primitive, ansd since they run about in a circle, the o/p goes rigth to the lowest value after crossing the highest one. i.e we effectively get Integer.MIN_VALUE BACK !
Balu Ramachandran

Joined: Oct 16, 2000
Posts: 16
Answewr is : -2147483648
abs() returns absolute value of the given argument.
but hear min. value for Integer wrapper exceeds. it is a cyclic process so that only u got above answer.

I agree. Here's the link: http://aspose.com/file-tools
subject: abs( ) method
It's not a secret anymore!