Originally posted by Chitra AP:
Hi All,
K&B book says ceil(), floor() and round() all return integer equivalent floating-point numbers. But the following code prints
System.out.println(Math.round(1.1)); //prints 1
System.out.println(Math.ceil(1.1)); // prints 2.0
The first line should print 1.0, correct? Thanks.
Chitra,
Math.round() returns int or long depending on the argument passed to it. i.e
Math.round(double d) will return long whereas Math.round(float f) would return you int data type.
Math.ceil(double d) always returns double.
Check this
link for Math functions.
Hope that helps...

Cheers,<br />Jay<br /> <br />(SCJP 1.4)<br />Heights of great men were not achieved in one day, they were toiling day and night while their companions slept.