File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes K&B chapter6 examwatch doubt 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 "K&B chapter6 examwatch doubt" Watch "K&B chapter6 examwatch doubt" New topic

K&B chapter6 examwatch doubt

Shiva Mohan
Ranch Hand

Joined: Jan 05, 2006
Posts: 481
The floor()and ceil()methods take only doubles. There are no
overloaded methods for integral numbers, because the methods would just
end up returning the integral numbers they were passed. The whole point
of floor()and ceil()is to convert floating-point numbers (doubles),
to integers, based on the rules of the methods. It may seem strange (it does
to us) that the integer values are returned in a double sized container, but
don�t let that throw you.

what the author is trying to say.please help since i don't get.
simple example would be very helpful.
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2398
What the author is saying is that they don't know why the developers made the output of the floor() and ceil() methods double and not int.

The purpose of floor() is to return the value of the mathematical operation greatest integer, [x].

ceil() is going to return the value of the mathematical operation, [x] + 1.

The author is warning you not to get confused because the output of the methods are double.
I agree. Here's the link:
subject: K&B chapter6 examwatch doubt
It's not a secret anymore!