This week's book giveaway is in the Agile forum. We're giving away four copies of The Software Craftsman and have Sandro Mancuso on-line! See this thread for details.

abs() method returns a non-negative value of the argument. -------------------------------------------------- System.out.println(Math.abs(Byte.MIN_VALUE)); System.out.println(Math.abs(Short.MIN_VALUE)); System.out.println(Math.abs(Float.MIN_VALUE)); System.out.println(Math.abs(Double.MIN_VALUE)); ----------------------------------------------------

These four lines are returning positive value.

---------------------------------------------------- System.out.println(Math.abs(Integer.MIN_VALUE)); System.out.println(Math.abs(Long.MIN_VALUE)); ---------------------------------------------------- But in this two cases it is returning negative value.why???

Can anyone clear my doubt....

" Don't be afraid of pressure. Remember that pressure is what turns a lump of coal into a diamond... " <br /> <br />Thanks & Regards...<br />Sakthi<br />SCJP1.4, OCA

abs(-128) overload abs(int) method so It doesn't return negative value/ abs(-2147483648) overload abs(int) method and return the value 2147483648. But this value greater than integer range. so It is return negative value. abs( -9223372036854775808) overlaod abs(long) method and return the value -9223372036854775808. But this is larger than long range. So It also returns negative value.

Raghu J<br />SCJP 1.4<br /> <br />The Wind and waters are always<br />on the side of the ablest navigators.<br /><a href="http://groups.yahoo.com/group/scjp_share" target="_blank" rel="nofollow">SCJP Group</a><br /><a href="http://groups.yahoo.com/group/JavaBeat_SCWCD" target="_blank" rel="nofollow">SCWCD Group</a>

Don't get me started about those stupid light bulbs.