This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Math.round() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Math.round()" Watch "Math.round()" New topic


nachagoni rishi

Joined: Oct 14, 2004
Posts: 26
how does Math.round work?
does it add 0.5 and do a ceil() or floor() depending on the number after the decimal point
it adds 0.5 and always does a Math.floor()
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
Please take the time to read the Java API for Math.
There is an explanation in the description of the round methods.

Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Arnab karmakar
Ranch Hand

Joined: Oct 04, 2004
Posts: 46
hi barry,

can u please tell me whether these type of question comes in SCJP exam or not.
I agree. Here's the link:
subject: Math.round()
It's not a secret anymore!